#include "wx/metafile.h"
#endif // Windows
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__)
#include "mondrian.xpm"
#include "dnd_copy.xpm"
// URLs can't be moved, only copied
virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
wxDragResult def)
- { return def == wxDragMove ? wxDragCopy : def; }
+ {
+ return wxDragLink; // At least IE 5.x needs wxDragLink, the
+ // other browsers on MSW seem okay with it too.
+ }
// translate this to calls to OnDropURL() just for convenience
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
~DnDFrame();
void OnPaint(wxPaintEvent& event);
+ void OnSize(wxSizeEvent& event);
void OnQuit (wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnDrag (wxCommandEvent& event);
EVT_LEFT_DOWN( DnDFrame::OnLeftDown)
EVT_RIGHT_DOWN( DnDFrame::OnRightDown)
EVT_PAINT( DnDFrame::OnPaint)
+ EVT_SIZE( DnDFrame::OnSize)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(DnDShapeFrame, wxFrame)
help_menu->Append(Menu_About, "&About");
wxMenu *clip_menu = new wxMenu;
- clip_menu->Append(Menu_Copy, "&Copy text\tCtrl+C");
- clip_menu->Append(Menu_Paste, "&Paste text\tCtrl+V");
+ clip_menu->Append(Menu_Copy, "&Copy text\tCtrl-C");
+ clip_menu->Append(Menu_Paste, "&Paste text\tCtrl-V");
clip_menu->AppendSeparator();
- clip_menu->Append(Menu_CopyBitmap, "Copy &bitmap\tAlt+C");
- clip_menu->Append(Menu_PasteBitmap, "Paste b&itmap\tAlt+V");
+ clip_menu->Append(Menu_CopyBitmap, "Copy &bitmap\tCtrl-Shift-C");
+ clip_menu->Append(Menu_PasteBitmap, "Paste b&itmap\tCtrl-Shift-V");
#ifdef USE_METAFILES
clip_menu->AppendSeparator();
clip_menu->Append(Menu_PasteMFile, "Paste &metafile\tCtrl-M");
#endif // USE_METAFILES
clip_menu->AppendSeparator();
- clip_menu->Append(Menu_CopyFiles, "Copy &files\tCtrl+F");
+ clip_menu->Append(Menu_CopyFiles, "Copy &files\tCtrl-F");
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File");
Close(TRUE);
}
+void DnDFrame::OnSize(wxSizeEvent& event)
+{
+ Refresh();
+
+ event.Skip();
+}
+
void DnDFrame::OnPaint(wxPaintEvent& WXUNUSED(event))
{
int w = 0;
GetClientSize( &w, &h );
wxPaintDC dc(this);
+ dc.Clear();
dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL, FALSE, "charter" ) );
dc.DrawText( "Drag text from here!", 100, h-50 );
}
wxLogStatus( _T("Decoding image file...") );
wxYield();
- wxBitmap bitmap( image.ConvertToBitmap() );
+ wxBitmap bitmap( image );
if ( !wxTheClipboard->Open() )
{
const wxString choices[] = { wxT("None"), wxT("Triangle"),
wxT("Rectangle"), wxT("Ellipse") };
- m_radio = new wxRadioBox( this, -1, wxT("&Shape"),
+ m_radio = new wxRadioBox( this, -1, wxT("&Shape"),
wxDefaultPosition, wxDefaultSize, 4, choices, 4,
wxRA_SPECIFY_COLS );
shapesSizer->Add( m_radio, 0, wxGROW|wxALL, 5 );
wxStaticBox* box = new wxStaticBox( this, -1, wxT("&Attributes") );
wxStaticBoxSizer* attrSizer = new wxStaticBoxSizer( box, wxHORIZONTAL );
wxFlexGridSizer* xywhSizer = new wxFlexGridSizer( 4, 2 );
-
+
wxStaticText* st;
st = new wxStaticText( this, -1, wxT("Position &X:") );
m_textX = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
wxSize( 30, 20 ) );
- xywhSizer->Add( st, 1, wxGROW|wxALL, 2 );
- xywhSizer->Add( m_textX, 1, wxGROW|wxALL, 2 );
+ xywhSizer->Add( st, 1, wxGROW|wxALL, 2 );
+ xywhSizer->Add( m_textX, 1, wxGROW|wxALL, 2 );
st = new wxStaticText( this, -1, wxT("Size &width:") );
m_textW = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
wxSize( 30, 20 ) );
- xywhSizer->Add( st, 1, wxGROW|wxALL, 2 );
- xywhSizer->Add( m_textW, 1, wxGROW|wxALL, 2 );
+ xywhSizer->Add( st, 1, wxGROW|wxALL, 2 );
+ xywhSizer->Add( m_textW, 1, wxGROW|wxALL, 2 );
st = new wxStaticText( this, -1, wxT("&Y:") );
m_textY = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
wxSize( 30, 20 ) );
- xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 );
- xywhSizer->Add( m_textY, 1, wxGROW|wxALL, 2 );
+ xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 );
+ xywhSizer->Add( m_textY, 1, wxGROW|wxALL, 2 );
st = new wxStaticText( this, -1, wxT("&height:") );
m_textH = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
wxSize( 30, 20 ) );
- xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 );
- xywhSizer->Add( m_textH, 1, wxGROW|wxALL, 2 );
+ xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 );
+ xywhSizer->Add( m_textH, 1, wxGROW|wxALL, 2 );
wxButton* col = new wxButton( this, Button_Colour, wxT("&Colour...") );
attrSizer->Add( xywhSizer, 1, wxGROW );
wxBitmap bitmap(x, y);
wxMemoryDC dc;
dc.SelectObject(bitmap);
- dc.SetBrush(wxBrush("white", wxSOLID));
+ dc.SetBrush(wxBrush(wxT("white"), wxSOLID));
dc.Clear();
m_shape->Draw(dc);
dc.SelectObject(wxNullBitmap);