git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45182
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void OnCopyFiles(wxCommandEvent& event);
void OnCopyFiles(wxCommandEvent& event);
+ void OnUsePrimary(wxCommandEvent& event);
+
void OnLeftDown(wxMouseEvent& event);
void OnRightDown(wxMouseEvent& event);
void OnLeftDown(wxMouseEvent& event);
void OnRightDown(wxMouseEvent& event);
Menu_PasteBitmap,
Menu_PasteMFile,
Menu_CopyFiles,
Menu_PasteBitmap,
Menu_PasteMFile,
Menu_CopyFiles,
Menu_Shape_New = 500,
Menu_Shape_Edit,
Menu_Shape_Clear,
Menu_Shape_New = 500,
Menu_Shape_Edit,
Menu_Shape_Clear,
EVT_MENU(Menu_PasteMFile, DnDFrame::OnPasteMetafile)
#endif // wxUSE_METAFILE
EVT_MENU(Menu_CopyFiles, DnDFrame::OnCopyFiles)
EVT_MENU(Menu_PasteMFile, DnDFrame::OnPasteMetafile)
#endif // wxUSE_METAFILE
EVT_MENU(Menu_CopyFiles, DnDFrame::OnCopyFiles)
+ EVT_MENU(Menu_UsePrimary, DnDFrame::OnUsePrimary)
EVT_UPDATE_UI(Menu_DragMoveDef, DnDFrame::OnUpdateUIMoveByDefault)
EVT_UPDATE_UI(Menu_DragMoveDef, DnDFrame::OnUpdateUIMoveByDefault)
wxImage::AddHandler( new wxPNGHandler );
#endif
wxImage::AddHandler( new wxPNGHandler );
#endif
- // under X we usually want to use the primary selection by default (which
- // is shared with other apps)
- wxTheClipboard->UsePrimarySelection();
-
// create the main frame window
DnDFrame *frame = new DnDFrame((wxFrame *) NULL,
_T("Drag-and-Drop/Clipboard wxWidgets Sample"),
// create the main frame window
DnDFrame *frame = new DnDFrame((wxFrame *) NULL,
_T("Drag-and-Drop/Clipboard wxWidgets Sample"),
#endif // wxUSE_METAFILE
clip_menu->AppendSeparator();
clip_menu->Append(Menu_CopyFiles, _T("Copy &files\tCtrl-F"));
#endif // wxUSE_METAFILE
clip_menu->AppendSeparator();
clip_menu->Append(Menu_CopyFiles, _T("Copy &files\tCtrl-F"));
+ clip_menu->AppendSeparator();
+ clip_menu->AppendCheckItem(Menu_UsePrimary, _T("Use &primary selection\tCtrl-P"));
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _T("&File"));
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _T("&File"));
+void DnDFrame::OnUsePrimary(wxCommandEvent& event)
+{
+ const bool usePrimary = event.IsChecked();
+ wxTheClipboard->UsePrimarySelection(usePrimary);
+
+ wxLogStatus(_T("Now using %s selection"), usePrimary ? _T("primary")
+ : _T("clipboard"));
+}
+
// ---------------------------------------------------------------------------
// bitmap clipboard
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// bitmap clipboard
// ---------------------------------------------------------------------------