File Coverage

lib/Kephra/Dialog.pm
Criterion Covered Total %
statement 6 39 15.3
branch 0 2 0.0
condition n/a
subroutine 2 24 8.3
pod 0 20 0.0
total 8 85 9.4


line stmt bran cond sub pod time code
1             package Kephra::Dialog;
2             our $VERSION = '0.20';
3              
4 1     1   936 use strict;
  1         2  
  1         27  
5 1     1   4 use warnings;
  1         2  
  1         843  
6              
7 0     0     sub _set_icon { my ($d, $cmd_id) = @_; }
8 0     0     sub _win { Kephra::App::Window::_ref() }
9              
10             # standard dialogs
11              
12             sub msg_box {
13 0     0 0   Wx::MessageBox( @_[0,1], &Wx::wxOK | &Wx::wxSTAY_ON_TOP, _win() );
14             }
15              
16             sub info_box {
17 0     0 0   Wx::MessageBox
18             (@_[0,1], &Wx::wxOK | &Wx::wxICON_INFORMATION | &Wx::wxSTAY_ON_TOP, _win());
19             }
20              
21             sub warning_box {
22 0     0 0   Wx::MessageBox
23             ( @_[0,1], &Wx::wxOK | &Wx::wxICON_WARNING | &Wx::wxSTAY_ON_TOP, _win() );
24             }
25              
26             sub get_confirm_2 {
27 0     0 0   Wx::MessageBox
28             (@_[0,1], &Wx::wxYES_NO | &Wx::wxICON_QUESTION | &Wx::wxSTAY_ON_TOP, _win());
29             }
30              
31             sub get_confirm_3 {
32 0     0 0   Wx::MessageBox
33             ( @_[0,1], &Wx::wxYES_NO | &Wx::wxCANCEL | &Wx::wxICON_QUESTION, _win() );
34             }
35              
36             sub get_file_open {
37 0     0 0   Wx::FileSelector( @_[0,1], '', '', $_[2], &Wx::wxFD_OPEN, _win());
38             }
39              
40             sub get_files_open {
41 0     0 0   my $dialog = Wx::FileDialog->new(
42             _win(), @_[0,1], '', $_[2], &Wx::wxFD_OPEN | &Wx::wxFD_MULTIPLE, [-1,-1]
43             );
44 0 0         if ($dialog->ShowModal != &Wx::wxID_CANCEL) {
45 0           my @files = $dialog->GetPaths;
46 0           return \@files;
47             }
48             }
49              
50             sub get_file_save {
51 0     0 0   Wx::FileSelector( @_[0,1], '', '', $_[2], &Wx::wxFD_SAVE, _win())
52             }
53              
54 0     0 0   sub get_dir { Wx::DirSelector ( @_[0,1] ,0, [-1,-1], _win()) }
55 0     0 0   sub get_font { Wx::GetFontFromUser ( _win(), $_[0]) }
56 0     0 0   sub get_text { Wx::GetTextFromUser ( $_[0], $_[1], "", _win()) }
57 0     0 0   sub get_number{Wx::GetNumberFromUser( $_[0], '', $_[1],$_[2], 0, 100000, _win())}
58              
59             # own dialogs
60              
61             sub find {
62 0     0 0   require Kephra::Dialog::Search;
63 0           &Kephra::Dialog::Search::find;
64             }
65              
66             sub replace {
67 0     0 0   require Kephra::Dialog::Search;
68 0           &Kephra::Dialog::Search::replace;
69             }
70             sub choose_color {
71 0     0 0   require Kephra::Dialog::Color;
72 0           Kephra::Dialog::Color::choose_color();
73             }
74             sub config {
75 0     0 0   require Kephra::Dialog::Config;
76 0           &Kephra::Dialog::Config::main;
77             }
78              
79             sub info {
80 0     0 0   require Kephra::Dialog::Info;
81 0           &Kephra::Dialog::Info::combined;
82             }
83              
84             sub notify_file_changed {
85 0     0 0   require Kephra::Dialog::Notify;
86 0           &Kephra::Dialog::Notify::file_changed;
87             }
88             sub notify_file_deleted {
89 0     0 0   require Kephra::Dialog::Notify;
90 0           &Kephra::Dialog::Notify::file_deleted;
91             }
92              
93             sub save_on_exit {
94 0     0 0   require Kephra::Dialog::Exit;
95 0           &Kephra::Dialog::Exit::save_on_exit;
96             }
97              
98             1;