
#import "b4i_main.h"
#import "b4i_square.h"
#import "b4i_circle.h"


@implementation b4i_main 


+ (instancetype)new {
    static b4i_main* shared = nil;
    if (shared == nil) {
        shared = [self alloc];
        shared.bi = [[B4I alloc] init:shared];
        shared.__c = [B4ICommon new];
    }
    return shared;
}

- (NSString*)  _application_background{
 //BA.debugLineNum = 46;BA.debugLine="Private Sub Application_Background";
 //BA.debugLineNum = 48;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _application_start:(B4INavigationControllerWrapper*) _nav{
[self initializeStaticModules];
 //BA.debugLineNum = 24;BA.debugLine="Private Sub Application_Start (Nav As NavigationCo";
 //BA.debugLineNum = 25;BA.debugLine="NavControl = Nav";
self._navcontrol = _nav;
 //BA.debugLineNum = 26;BA.debugLine="Page1.Initialize(\"Page1\")";
[self._page1 Initialize:self.bi :@"Page1"];
 //BA.debugLineNum = 27;BA.debugLine="Page1.Title = \"jDraw\"";
[self._page1 setTitle:@"jDraw"];
 //BA.debugLineNum = 28;BA.debugLine="Page1.RootPanel.Color = Colors.White";
[[self._page1 RootPanel] setColor:[[self.__c Colors] White]];
 //BA.debugLineNum = 29;BA.debugLine="NavControl.ShowPage(Page1)";
[self._navcontrol ShowPage:(UIViewController*)((self._page1).object)];
 //BA.debugLineNum = 31;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _drawallshapes{
int _i = 0;
 //BA.debugLineNum = 50;BA.debugLine="Private Sub DrawAllShapes";
 //BA.debugLineNum = 51;BA.debugLine="Private i As Int";
_i = 0;
 //BA.debugLineNum = 53;BA.debugLine="For i = 0 To Shapes.Size - 1";
{
const int step2 = 1;
const int limit2 = (int) ([self._shapes Size]-1);
for (_i = (int) (0) ; (step2 > 0 && _i <= limit2) || (step2 < 0 && _i >= limit2); _i = ((int)(0 + _i + step2)) ) {
 //BA.debugLineNum = 54;BA.debugLine="CallSub2(Shapes.Get(i), \"Draw\", cvsMain)";
[self.__c CallSub2:self.bi :[self._shapes Get:_i] :@"Draw" :(NSObject*)(self._cvsmain)];
 }
};
 //BA.debugLineNum = 56;BA.debugLine="cvsMain.Refresh";
[self._cvsmain Refresh];
 //BA.debugLineNum = 57;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _page1_resize:(int) _width :(int) _height{
b4i_square* _square1 = nil;
b4i_square* _square2 = nil;
b4i_circle* _circle1 = nil;
 //BA.debugLineNum = 33;BA.debugLine="Private Sub Page1_Resize(Width As Int, Height As I";
 //BA.debugLineNum = 34;BA.debugLine="cvsMain.Initialize(Page1.RootPanel)";
[self._cvsmain Initialize:(B4IViewWrapper*) [B4IObjectWrapper createWrapper:[B4IViewWrapper new] object:(UIView*)(([self._page1 RootPanel]).object)]];
 //BA.debugLineNum = 36;BA.debugLine="Private Square1, Square2 As Square";
_square1 = [b4i_square new];
_square2 = [b4i_square new];
 //BA.debugLineNum = 37;BA.debugLine="Private Circle1 As Circle";
_circle1 = [b4i_circle new];
 //BA.debugLineNum = 38;BA.debugLine="Shapes.Initialize";
[self._shapes Initialize];
 //BA.debugLineNum = 39;BA.debugLine="Square1.Initialize(Shapes, 110dip, 110dip, 50dip)";
[_square1 _initialize:self.bi :self._shapes :[self.__c DipToCurrent:(int) (110)] :[self.__c DipToCurrent:(int) (110)] :[self.__c DipToCurrent:(int) (50)]];
 //BA.debugLineNum = 40;BA.debugLine="Square2.Initialize(Shapes, 10dip, 10dip, 100dip)";
[_square2 _initialize:self.bi :self._shapes :[self.__c DipToCurrent:(int) (10)] :[self.__c DipToCurrent:(int) (10)] :[self.__c DipToCurrent:(int) (100)]];
 //BA.debugLineNum = 41;BA.debugLine="Circle1.Initialize(Shapes, 50%x, 50%y, 100dip)";
[_circle1 _initialize:self.bi :self._shapes :(int) ([self.__c PerXToCurrent:(float) (50)]) :(int) ([self.__c PerYToCurrent:(float) (50)]) :[self.__c DipToCurrent:(int) (100)]];
 //BA.debugLineNum = 43;BA.debugLine="DrawAllShapes";
[self _drawallshapes];
 //BA.debugLineNum = 44;BA.debugLine="End Sub";
return @"";
}

- (void)initializeStaticModules {
    [[b4i_main new]initializeModule];

}
- (NSString*)  _process_globals{
 //BA.debugLineNum = 13;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 16;BA.debugLine="Public App As Application";
self._app = [B4IApplicationWrapper new];
 //BA.debugLineNum = 17;BA.debugLine="Public NavControl As NavigationController";
self._navcontrol = [B4INavigationControllerWrapper new];
 //BA.debugLineNum = 18;BA.debugLine="Private Page1 As Page";
self._page1 = [B4IPage new];
 //BA.debugLineNum = 20;BA.debugLine="Public Shapes As List";
self._shapes = [B4IList new];
 //BA.debugLineNum = 21;BA.debugLine="Private cvsMain As Canvas";
self._cvsmain = [B4ICanvas new];
 //BA.debugLineNum = 22;BA.debugLine="End Sub";
return @"";
}
@end
