allow the user to press Esc to close preview frame wherever the focus is, not only if it's on the canvas itself (patch 1719276)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48841 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -388,8 +388,10 @@ protected:
|
|||||||
wxWindowDisabler* m_windowDisabler;
|
wxWindowDisabler* m_windowDisabler;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_CLASS(wxPreviewFrame)
|
void OnChar(wxKeyEvent& event);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
DECLARE_CLASS(wxPreviewFrame)
|
||||||
DECLARE_NO_COPY_CLASS(wxPreviewFrame)
|
DECLARE_NO_COPY_CLASS(wxPreviewFrame)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -878,20 +878,14 @@ void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|||||||
void wxPreviewCanvas::OnChar(wxKeyEvent &event)
|
void wxPreviewCanvas::OnChar(wxKeyEvent &event)
|
||||||
{
|
{
|
||||||
wxPreviewControlBar* controlBar = ((wxPreviewFrame*) GetParent())->GetControlBar();
|
wxPreviewControlBar* controlBar = ((wxPreviewFrame*) GetParent())->GetControlBar();
|
||||||
if (event.GetKeyCode() == WXK_ESCAPE)
|
switch (event.GetKeyCode())
|
||||||
{
|
{
|
||||||
((wxPreviewFrame*) GetParent())->Close(true);
|
case WXK_TAB:
|
||||||
return;
|
controlBar->OnGoto();
|
||||||
}
|
return;
|
||||||
else if (event.GetKeyCode() == WXK_TAB)
|
case WXK_RETURN:
|
||||||
{
|
controlBar->OnPrint();
|
||||||
controlBar->OnGoto();
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (event.GetKeyCode() == WXK_RETURN)
|
|
||||||
{
|
|
||||||
controlBar->OnPrint();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.ControlDown())
|
if (!event.ControlDown())
|
||||||
@@ -1224,9 +1218,22 @@ int wxPreviewControlBar::GetZoomControl()
|
|||||||
IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
|
IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxPreviewFrame, wxFrame)
|
BEGIN_EVENT_TABLE(wxPreviewFrame, wxFrame)
|
||||||
|
EVT_CHAR_HOOK(wxPreviewFrame::OnChar)
|
||||||
EVT_CLOSE(wxPreviewFrame::OnCloseWindow)
|
EVT_CLOSE(wxPreviewFrame::OnCloseWindow)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
void wxPreviewFrame::OnChar(wxKeyEvent &event)
|
||||||
|
{
|
||||||
|
if ( event.GetKeyCode() == WXK_ESCAPE )
|
||||||
|
{
|
||||||
|
Close(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase *preview, wxWindow *parent, const wxString& title,
|
wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase *preview, wxWindow *parent, const wxString& title,
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
|
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
|
||||||
wxFrame(parent, wxID_ANY, title, pos, size, style, name)
|
wxFrame(parent, wxID_ANY, title, pos, size, style, name)
|
||||||
|
Reference in New Issue
Block a user