Source

Kephra / lib / Kephra / App / Dialog.pm

use strict;
use warnings;
use Wx;
use Kephra::API;
use Kephra::CommandList;

package Kephra::App::Dialog;

Kephra::CommandList::register_cmd({
 'config-global-dialog' => {
		sub => 'config',    label => 'Global Dialog',keys  => 'ctrl+alt+c'},
 'config-keymap-dialog' => {
		sub => 'keymap',    label => 'Keymapping',keys  => 'ctrl+alt+k'},
 'help-documentation' => {
		sub => 'documentation', label => 'Documentation',keys  => 'F1'},
 'help-about' => {
		sub => 'about', label => 'About...', keys  => ''},
 'help-homepage' => {
		sub => 'Kephra::App::Util::lounch_browser',
		parameter => 'http://kephra.sourceforge.net/site/en/home_news.shtml',
		label => 'Homepage', keys  => '', help => ''},
 'help-bugreport' => {
		sub => 'Kephra::App::Util::lounch_browser',
		parameter => 'http://sourceforge.net/tracker/?func=add&group_id=169747&atid=851593',
		label => 'Send a Wish', keys  => '', help => ''},
});


# supplies and checks parents of a dialog
sub _parent {
	my $parent = shift;
	return Kephra::API::main_window() unless defined $parent;
	Kephra::Log::error("need a window as parent not $parent")
		unless $parent and ref $parent and $parent->isa('Wx::Window');
	return $parent;
}

# standard dialogs

sub msg_box {
	Wx::MessageBox( @_[0,1], &Wx::wxOK | &Wx::wxSTAY_ON_TOP, _parent($_[2]) )
}
#sub info_box {
	#Wx::MessageBox(
		#@_[0,1],
		#&Wx::wxOK | &Wx::wxICON_INFORMATION | &Wx::wxSTAY_ON_TOP, 
		#_parent($_[2]),
	#);
#}
#
#sub warning_box {
	#Wx::MessageBox(
		#@_[0,1],
		#&Wx::wxOK | &Wx::wxICON_WARNING | &Wx::wxSTAY_ON_TOP,
		#Kephra::API::main_window()
	#);
#}
#
#sub get_confirm_2 {
	#Wx::MessageBox
		#(@_[0,1], &Wx::wxYES_NO | &Wx::wxICON_QUESTION | &Wx::wxSTAY_ON_TOP, _win());
#}
#
#sub get_confirm_3 {
	#Wx::MessageBox
		#( @_[0,1], &Wx::wxYES_NO | &Wx::wxCANCEL | &Wx::wxICON_QUESTION, _win() );
#}
#
#sub get_file_open {
	#Wx::FileSelector( @_[0,1], '', '', $_[2], &Wx::wxFD_OPEN, _win());
#}
#
#sub get_files_open {
	#my $dialog = Wx::FileDialog->new(
		#_win(),  @_[0,1], '', $_[2], &Wx::wxFD_OPEN | &Wx::wxFD_MULTIPLE, [-1,-1]
	#);
	#if ($dialog->ShowModal != &Wx::wxID_CANCEL) {
		#my @files = $dialog->GetPaths;
		#return \@files;
	#}
#}
#
#sub get_file_save { 
	#Wx::FileSelector( @_[0,1], '', '', $_[2], &Wx::wxFD_SAVE, _win())
#}
#
#sub get_dir  {  Wx::DirSelector      ( @_[0,1] ,0, [-1,-1], _win()) }
#sub get_font {  Wx::GetFontFromUser  ( _win(), $_[0]) }
#sub get_text {  Wx::GetTextFromUser  ( $_[0], $_[1], "", _win()) }
#sub get_number {Wx::GetNumberFromUser( $_[0], '', $_[1],$_[2], 0, 100000, _win())}
#
# own dialogs
#sub find {
	#require Kephra::App::Dialog::Search; &Kephra::App::Dialog::Search::find;
#}
#sub replace {
	#require Kephra::App::Dialog::Search; &Kephra::App::Dialog::Search::replace;
#}
#sub choose_color {
	#require Kephra::App::Dialog::Color; Kephra::App::Dialog::Color::choose_color();
#}
sub about {
	require Kephra::App::Dialog::About;
	Kephra::App::Dialog::About::create( )->ShowModal;
}
sub config {
	require Kephra::App::Dialog::Config;
	Kephra::App::Dialog::Config::create( )->ShowModal;
}
sub documentation {
	require Kephra::App::Dialog::Documentation;
	Kephra::App::Dialog::Documentation::create( )->ShowModal;
}
sub keymap {
	require Kephra::App::Dialog::Keymap;
	Kephra::App::Dialog::Keymap::create( )->ShowModal;
}

#sub notify_file_changed {
	#require Kephra::App::Dialog::Notify; &Kephra::App::Dialog::Notify::file_changed;
#}
#sub notify_file_deleted {
	#require Kephra::App::Dialog::Notify; &Kephra::App::Dialog::Notify::file_deleted;
#}
#sub save_on_exit {
	#require Kephra::App::Dialog::Exit; &Kephra::App::Dialog::Exit::save_on_exit;
#}


1;
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.