Commits

Herbert Breunung  committed a26cec8

stricter oo-design and on time loading

  • Participants
  • Parent commits 4cebb84

Comments (0)

Files changed (2)

File lib/Kephra.pm

 );
 our @used_wx_modules = qw/Wx::AUI Wx::STC/;
 
+our @needed_at_first = qw/App API/;
+
 sub load_libs {
     eval "require $_" for @external_dependencies, @used_wx_modules;
+    eval "require Kephra::$_" for @needed_at_first;
 
     #require Kephra::API;   # 
-    require Kephra::App;   # visible main application
     #require Kephra::App::MenuBar;
     #require Kephra::App::TabBar;
     #require Kephra::CommandList;

File lib/Kephra/App.pm

 
 sub OnInit {
     my $app = shift;
-    my $frame = Wx::Frame->new(undef, -1, __PACKAGE__);
-    my %sizer;
-    $sizer{'main'} = Wx::BoxSizer->new(&Wx::wxHORIZONTAL);
-    $sizer{'leftcolumn'} = Wx::BoxSizer->new(&Wx::wxVERTICAL);
-    $sizer{'centercolumn'} = Wx::BoxSizer->new(&Wx::wxVERTICAL);
-    $sizer{'rightcolumn'} = Wx::BoxSizer->new(&Wx::wxVERTICAL);
-    my $nb = Wx::AuiNotebook->new($frame,-1, [-1,-1], [-1,-1],
-        &Wx::wxAUI_NB_TOP | &Wx::wxAUI_NB_TAB_SPLIT | &Wx::wxAUI_NB_TAB_MOVE | 
-        &Wx::wxAUI_NB_SCROLL_BUTTONS | &Wx::wxAUI_NB_CLOSE_ON_ACTIVE_TAB,
-    );
-    $nb->AddPage(Wx::StyledTextCtrl->new($nb,-1),'<untitled>',1);
-    $sizer{'main'}->Add($sizer{'centercolumn'}, 1, &Wx::wxGROW);
-    $sizer{'centercolumn'}->Add($nb, 1, &Wx::wxGROW);
+    require Kephra::App::Window;
+    my $frame = Kephra::App::Window->new(__PACKAGE__);
 
-    Wx::Event::EVT_CLOSE($frame, sub{$frame->Close; $_[1]->Skip });
-
-    $frame->SetSizer( $sizer{'main'});
     $frame->Center();
     $frame->Show();
-     $app->ExitMainLoop(1);
     1;
 }
 
     1;
 }
 
+# $app->ExitMainLoop(1);
 1;