X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4693b20c7500190c3cc8c02919c45436bf5efbc9..8916d00747c8e7b704ad549afcd8d0f88b6d861e:/samples/dnd/dnd.cpp diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index 164dd9c712..ea4bb3ece5 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -109,7 +109,10 @@ public: // 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) @@ -221,6 +224,7 @@ public: ~DnDFrame(); void OnPaint(wxPaintEvent& event); + void OnSize(wxSizeEvent& event); void OnQuit (wxCommandEvent& event); void OnAbout(wxCommandEvent& event); void OnDrag (wxCommandEvent& event); @@ -813,6 +817,7 @@ BEGIN_EVENT_TABLE(DnDFrame, wxFrame) 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) @@ -928,17 +933,17 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h) 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"); @@ -1006,6 +1011,13 @@ void DnDFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) Close(TRUE); } +void DnDFrame::OnSize(wxSizeEvent& event) +{ + Refresh(); + + event.Skip(); +} + void DnDFrame::OnPaint(wxPaintEvent& WXUNUSED(event)) { int w = 0; @@ -1013,6 +1025,7 @@ void DnDFrame::OnPaint(wxPaintEvent& WXUNUSED(event)) 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 ); } @@ -1462,7 +1475,7 @@ DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape) 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 ); @@ -1472,32 +1485,32 @@ DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape) 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 ); @@ -1861,7 +1874,7 @@ void DnDShapeDataObject::CreateBitmap() const 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);