Added "Copy" to right click menu in WX_HTML_REPORT_PANEL
This commit is contained in:
parent
17d63dbc1f
commit
a42aed3305
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <gal/color4d.h>
|
||||
|
||||
#include <wx/clipbrd.h>
|
||||
|
||||
WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent,
|
||||
wxWindowID id,
|
||||
|
@ -38,6 +38,9 @@ WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent,
|
|||
{
|
||||
syncCheckboxes();
|
||||
m_htmlView->SetPage( addHeader( "" ) );
|
||||
|
||||
Connect( wxEVT_COMMAND_MENU_SELECTED,
|
||||
wxMenuEventHandler( WX_HTML_REPORT_PANEL::onMenuEvent ), NULL, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -275,12 +278,36 @@ wxString WX_HTML_REPORT_PANEL::generatePlainText( const REPORT_LINE& aLine )
|
|||
}
|
||||
|
||||
|
||||
void WX_HTML_REPORT_PANEL::onRightClick( wxMouseEvent& event )
|
||||
{
|
||||
wxMenu popup;
|
||||
popup.Append( wxID_COPY, "Copy" );
|
||||
PopupMenu( &popup );
|
||||
}
|
||||
|
||||
|
||||
void WX_HTML_REPORT_PANEL::onMenuEvent( wxMenuEvent& event )
|
||||
{
|
||||
if( event.GetId() == wxID_COPY )
|
||||
{
|
||||
if( wxTheClipboard->Open() )
|
||||
{
|
||||
bool primarySelection = wxTheClipboard->IsUsingPrimarySelection();
|
||||
wxTheClipboard->UsePrimarySelection( false ); // required to use the main clipboard
|
||||
wxTheClipboard->SetData( new wxTextDataObject( m_htmlView->SelectionToText() ) );
|
||||
wxTheClipboard->Close();
|
||||
wxTheClipboard->UsePrimarySelection( primarySelection );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WX_HTML_REPORT_PANEL::onCheckBoxShowAll( wxCommandEvent& event )
|
||||
{
|
||||
if ( event.IsChecked() )
|
||||
m_showAll = true;
|
||||
else
|
||||
m_showAll = false;
|
||||
if( event.IsChecked() )
|
||||
m_showAll = true;
|
||||
else
|
||||
m_showAll = false;
|
||||
|
||||
syncCheckboxes();
|
||||
refreshView();
|
||||
|
|
|
@ -98,6 +98,8 @@ private:
|
|||
void scrollToBottom();
|
||||
void syncCheckboxes();
|
||||
|
||||
void onRightClick( wxMouseEvent& event ) override;
|
||||
void onMenuEvent( wxMenuEvent& event );
|
||||
void onCheckBoxShowAll( wxCommandEvent& event ) override;
|
||||
void onCheckBoxShowWarnings( wxCommandEvent& event ) override;
|
||||
void onCheckBoxShowErrors( wxCommandEvent& event ) override;
|
||||
|
|
|
@ -72,6 +72,7 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow
|
|||
m_box->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
m_htmlView->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( WX_HTML_REPORT_PANEL_BASE::onRightClick ), NULL, this );
|
||||
m_checkBoxShowAll->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowAll ), NULL, this );
|
||||
m_checkBoxShowErrors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowErrors ), NULL, this );
|
||||
m_checkBoxShowWarnings->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowWarnings ), NULL, this );
|
||||
|
@ -83,6 +84,7 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow
|
|||
WX_HTML_REPORT_PANEL_BASE::~WX_HTML_REPORT_PANEL_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_htmlView->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( WX_HTML_REPORT_PANEL_BASE::onRightClick ), NULL, this );
|
||||
m_checkBoxShowAll->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowAll ), NULL, this );
|
||||
m_checkBoxShowErrors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowErrors ), NULL, this );
|
||||
m_checkBoxShowWarnings->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowWarnings ), NULL, this );
|
||||
|
|
|
@ -181,7 +181,7 @@
|
|||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnRightUp">onRightClick</event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// C++ code generated with wxFormBuilder (version Oct 17 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_HTML_REPORT_PANEL_BASE_H__
|
||||
|
@ -53,6 +53,7 @@ class WX_HTML_REPORT_PANEL_BASE : public wxPanel
|
|||
wxButton* m_btnSaveReportToFile;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onRightClick( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void onCheckBoxShowAll( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onCheckBoxShowErrors( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onCheckBoxShowWarnings( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
|
Loading…
Reference in New Issue