// Author: Vadim Zeitlin
// Modified by:
// Created: 04/01/98
-// RCS-ID: $Id$
// Copyright:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#endif // wxUSE_METAFILE
void OnCopyFiles(wxCommandEvent& event);
+ void OnCopyURL(wxCommandEvent& event);
void OnUsePrimary(wxCommandEvent& event);
virtual void Draw(wxDC& dc)
{
- dc.SetPen(wxPen(m_col, 1, wxSOLID));
+ dc.SetPen(wxPen(m_col));
}
protected:
dc.DrawLine(p3, p1);
//works in multicolor modes; on GTK (at least) will fail in 16-bit color
- dc.SetBrush(wxBrush(m_col, wxSOLID));
+ dc.SetBrush(wxBrush(m_col));
dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER);
}
};
dc.DrawLine(p3, p4);
dc.DrawLine(p4, p1);
- dc.SetBrush(wxBrush(m_col, wxSOLID));
+ dc.SetBrush(wxBrush(m_col));
dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER);
}
};
dc.DrawEllipse(m_pos, m_size);
- dc.SetBrush(wxBrush(m_col, wxSOLID));
+ dc.SetBrush(wxBrush(m_col));
dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER);
}
};
Menu_PasteBitmap,
Menu_PasteMFile,
Menu_CopyFiles,
+ Menu_CopyURL,
Menu_UsePrimary,
Menu_Shape_New = 500,
Menu_Shape_Edit,
EVT_MENU(Menu_PasteMFile, DnDFrame::OnPasteMetafile)
#endif // wxUSE_METAFILE
EVT_MENU(Menu_CopyFiles, DnDFrame::OnCopyFiles)
+ EVT_MENU(Menu_CopyURL, DnDFrame::OnCopyURL)
EVT_MENU(Menu_UsePrimary, DnDFrame::OnUsePrimary)
EVT_UPDATE_UI(Menu_DragMoveDef, DnDFrame::OnUpdateUIMoveByDefault)
#endif // wxUSE_METAFILE
clip_menu->AppendSeparator();
clip_menu->Append(Menu_CopyFiles, wxT("Copy &files\tCtrl-F"));
+ clip_menu->Append(Menu_CopyURL, wxT("Copy &URL\tCtrl-U"));
clip_menu->AppendSeparator();
clip_menu->AppendCheckItem(Menu_UsePrimary, wxT("Use &primary selection\tCtrl-P"));
m_ctrlDir->Connect
(
wxID_ANY,
- wxEVT_COMMAND_TREE_BEGIN_DRAG,
+ wxEVT_TREE_BEGIN_DRAG,
wxTreeEventHandler(DnDFrame::OnBeginDrag),
NULL,
this
#endif // MSW/!MSW
}
+void DnDFrame::OnCopyURL(wxCommandEvent& WXUNUSED(event))
+{
+ // Just hard code it for now, we could ask the user but the point here is
+ // to test copying URLs, it doesn't really matter what it is.
+ const wxString url("http://www.wxwidgets.org/");
+
+ wxClipboardLocker locker;
+ if ( !!locker && wxTheClipboard->AddData(new wxURLDataObject(url)) )
+ {
+ wxLogStatus(this, "Copied URL \"%s\" to %s.",
+ url,
+ GetMenuBar()->IsChecked(Menu_UsePrimary)
+ ? "primary selection"
+ : "clipboard");
+ }
+ else
+ {
+ wxLogError("Failed to copy URL.");
+ }
+}
+
// ---------------------------------------------------------------------------
// text clipboard
// ---------------------------------------------------------------------------
wxBitmap bitmap(x, y);
wxMemoryDC dc;
dc.SelectObject(bitmap);
- dc.SetBrush(wxBrush(wxT("white"), wxSOLID));
+ dc.SetBrush(*wxWHITE_BRUSH);
dc.Clear();
m_shape->Draw(dc);
dc.SelectObject(wxNullBitmap);