Herbert Breunung avatar Herbert Breunung committed 0a45a50

new API to get widget ref

Comments (0)

Files changed (3)

lib/Kephra/API.pm

 
 package Kephra::API;
 
-sub _app        { $Kephra::App::app }
-sub _app_window { $Kephra::App::win }
+my %widget = (
+	main_win => $Kephra::App::win,
+	main_window => $Kephra::App::win,
+	doc_bar => $Kephra::App::win->{'tabbar'}{'lo'},
+	document_bar => $Kephra::App::win->{'tabbar'}{'lo'},
+);
+
+
+# gui parts of main window
+sub _app   { $Kephra::App::app }
+sub widget {
+	my $name = shift;
+	die "requested widget withou name from Kephra::API::widget " unless $name;
+	my $demand = $widget{ $name };
+	die caller, "wanted a widget noneexisting in the API: ", $name unless $demand;
+}
+
 sub configs  { }
 
 sub current_document { }

lib/Kephra/App/Bar/Menu.pm

     $help_menu->Append( 8003, 'Info');
     $bar->Append($help_menu, 'Help');
 
-    my $win = Kephra::API::_app_window();
+    my $win = Kephra::API::widget('main_window');
+
+    Wx::Event::EVT_MENU( $win, 1000, sub { Kephra::API::widget('doc_bar')->add_edit_page() } );
 
     return $bar;
 }

lib/Kephra/App/Window.pm

                                                                or $name eq 'below';
         $panel{ $name }->SetSizer( $sizer{ $name } );
     }
-    my $tabbarright = Kephra::App::Bar::Tab          ->new( $panel{'edit'} );
-    my $searchbar   = Kephra::App::Bar::Search       ->new( $panel{'above'} );
+    my $tabbar_lo   = $win->{'tabbar'}{'lo'} = Kephra::App::Bar::Tab       ->new( $panel{'edit'} );
+    my $searchbar   = $win->{'searchbar'} = Kephra::App::Bar::Search       ->new( $panel{'above'} );
     my $iounit      = Kephra::App::Panel::IOUnit     ->new( $panel{'below'} );
     my $filebrowser = Kephra::App::Panel::FileBrowser->new( $panel{'left'} );
    #my $projectman  = Kephra::App::Panel::ProjectManarger->new( $panel{'left'} );
     
     #Wx::Event::EVT_SPLITTER_DCLICK( ,sub {});
     #&Wx::wxSP_NOBORDER  );
-    Wx::Event::EVT_MENU( $win, 1000, sub { $tabbarright->add_edit_page() } );
     #Wx::Event::EVT_CLOSE($frame, sub{$frame->Close; $_[1]->Skip });
 
     return $win;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.