40
41
Wx::gettext('Quick Menu Access'),
41
Wx::wxDefaultPosition,
43
Wx::wxDEFAULT_FRAME_STYLE | Wx::wxTAB_TRAVERSAL,
44
Wx::DEFAULT_FRAME_STYLE | Wx::TAB_TRAVERSAL,
46
47
# Dialog's icon as is the same as Padre
65
66
# Open the selected menu item if the user pressed OK
66
67
my $selection = $self->_list->GetSelection;
68
return if $selection == Wx::NOT_FOUND;
67
69
my $action = $self->_list->GetClientData($selection);
69
71
my %actions = %{ Padre::ide->actions };
70
72
my $menu_action = $actions{ $action->{name} };
71
73
if ($menu_action) {
85
87
eval { &$event($main); };
89
sprintf( Wx::gettext('Error while trying to perform Padre action: %s'), $error ),
94
TRACE("Error while trying to perform Padre action: $error") if DEBUG;
89
$main->error(sprintf( Wx::gettext('Error while trying to perform Padre action: %s'), $@ ));
90
TRACE("Error while trying to perform Padre action: $@") if DEBUG;
97
93
# And insert a recently used tuple if it is not found
148
144
my $sizer = $self->_sizer;
150
146
$self->{ok_button} = Wx::Button->new(
151
$self, Wx::wxID_OK, Wx::gettext('&OK'),
147
$self, Wx::ID_OK, Wx::gettext('&OK'),
153
149
$self->{ok_button}->SetDefault;
154
150
$self->{cancel_button} = Wx::Button->new(
155
$self, Wx::wxID_CANCEL, Wx::gettext('&Cancel'),
151
$self, Wx::ID_CANCEL, Wx::gettext('&Cancel'),
158
my $buttons = Wx::BoxSizer->new(Wx::wxHORIZONTAL);
154
my $buttons = Wx::BoxSizer->new(Wx::HORIZONTAL);
159
155
$buttons->AddStretchSpacer;
160
$buttons->Add( $self->{ok_button}, 0, Wx::wxALL | Wx::wxEXPAND, 5 );
161
$buttons->Add( $self->{cancel_button}, 0, Wx::wxALL | Wx::wxEXPAND, 5 );
162
$sizer->Add( $buttons, 0, Wx::wxALL | Wx::wxEXPAND | Wx::wxALIGN_CENTER, 5 );
156
$buttons->Add( $self->{ok_button}, 0, Wx::ALL | Wx::EXPAND, 5 );
157
$buttons->Add( $self->{cancel_button}, 0, Wx::ALL | Wx::EXPAND, 5 );
158
$sizer->Add( $buttons, 0, Wx::ALL | Wx::EXPAND | Wx::ALIGN_CENTER, 5 );
164
Wx::Event::EVT_BUTTON( $self, Wx::wxID_OK, \&_on_ok_button_clicked );
160
Wx::Event::EVT_BUTTON( $self, Wx::ID_OK, \&_on_ok_button_clicked );
186
182
Wx::ListBox->new(
187
$self, -1, Wx::wxDefaultPosition, Wx::wxDefaultSize, [],
183
$self, -1, Wx::DefaultPosition, Wx::DefaultSize, [],
192
188
# Shows how many items are selected and information about what is selected
193
require Padre::Wx::HtmlWindow;
194
189
$self->_status_text(
195
190
Padre::Wx::HtmlWindow->new(
198
Wx::wxDefaultPosition,
204
199
$self->_sizer->AddSpacer(10);
205
$self->_sizer->Add( $search_label, 0, Wx::wxALL | Wx::wxEXPAND, 2 );
206
$self->_sizer->Add( $self->_search_text, 0, Wx::wxALL | Wx::wxEXPAND, 2 );
207
$self->_sizer->Add( $matches_label, 0, Wx::wxALL | Wx::wxEXPAND, 2 );
208
$self->_sizer->Add( $self->_list, 1, Wx::wxALL | Wx::wxEXPAND, 2 );
209
$self->_sizer->Add( $self->_status_text, 0, Wx::wxALL | Wx::wxEXPAND, 2 );
200
$self->_sizer->Add( $search_label, 0, Wx::ALL | Wx::EXPAND, 2 );
201
$self->_sizer->Add( $self->_search_text, 0, Wx::ALL | Wx::EXPAND, 2 );
202
$self->_sizer->Add( $matches_label, 0, Wx::ALL | Wx::EXPAND, 2 );
203
$self->_sizer->Add( $self->_list, 1, Wx::ALL | Wx::EXPAND, 2 );
204
$self->_sizer->Add( $self->_status_text, 0, Wx::ALL | Wx::EXPAND, 2 );
211
206
$self->_setup_events;
227
222
my $code = $event->GetKeyCode;
229
224
$self->_list->SetFocus
230
if ( $code == Wx::WXK_DOWN )
231
or ( $code == Wx::WXK_UP )
232
or ( $code == Wx::WXK_NUMPAD_PAGEDOWN )
233
or ( $code == Wx::WXK_PAGEDOWN );
225
if ( $code == Wx::K_DOWN )
226
or ( $code == Wx::K_UP )
227
or ( $code == Wx::K_NUMPAD_PAGEDOWN )
228
or ( $code == Wx::K_PAGEDOWN );
257
252
my $selection = $self->_list->GetSelection;
258
if ( $selection != Wx::wxNOT_FOUND ) {
253
if ( $selection != Wx::NOT_FOUND ) {
259
254
my $action = $self->_list->GetClientData($selection);
260
255
$self->_status_text->SetPage( $self->_label( $action->{value}, $action->{name} ) );