Implement wxClipboard::Flush() in wxGTK

Update the documentation and also add a call of Flush() to the sample.

Closes #10515.

Closes https://github.com/wxWidgets/wxWidgets/pull/1316
This commit is contained in:
oneeyeman1
2019-05-04 13:28:59 -05:00
committed by Vadim Zeitlin
parent 02adddfa1a
commit 28a84486bd
4 changed files with 26 additions and 3 deletions

View File

@@ -50,6 +50,7 @@ public:
void OnQuit(wxCommandEvent&event);
void OnAbout(wxCommandEvent&event);
void OnFlush(wxCommandEvent &event);
void OnWriteClipboardContents(wxCommandEvent&event);
void OnUpdateUI(wxUpdateUIEvent&event);
#if USE_ASYNCHRONOUS_CLIPBOARD_REQUEST
@@ -71,12 +72,14 @@ enum
ID_Quit = wxID_EXIT,
ID_About = wxID_ABOUT,
ID_Write = 100,
ID_Text = 101
ID_Text = 101,
ID_Flush = 102
};
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
EVT_MENU(ID_About, MyFrame::OnAbout)
EVT_MENU(ID_Flush, MyFrame::OnFlush)
EVT_BUTTON(ID_Write, MyFrame::OnWriteClipboardContents)
EVT_UPDATE_UI(ID_Write, MyFrame::OnUpdateUI)
#if USE_ASYNCHRONOUS_CLIPBOARD_REQUEST
@@ -116,6 +119,7 @@ MyFrame::MyFrame(const wxString& title)
wxMenu *helpMenu = new wxMenu;
helpMenu->Append(ID_About, "&About\tF1", "Show about dialog");
fileMenu->Append(ID_Flush, "Flush the clipboard" );
fileMenu->Append(ID_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar...
@@ -137,6 +141,14 @@ MyFrame::MyFrame(const wxString& title)
panel->SetSizer( main_sizer );
}
void MyFrame::OnFlush(wxCommandEvent &WXUNUSED(event))
{
if ( wxTheClipboard->Flush() )
m_textctrl->SetValue( "Clipboard flushed successfully!!\n" );
else
m_textctrl->SetValue( "Flushing clipboard failed!!\n" );
}
void MyFrame::OnWriteClipboardContents(wxCommandEvent& WXUNUSED(event))
{
if (wxTheClipboard->Open())