#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"
~DnDFrame();
void OnPaint(wxPaintEvent& event);
+ void OnSize(wxSizeEvent& event);
void OnQuit (wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnDrag (wxCommandEvent& event);
}
protected:
+ //get a point 1 up and 1 left, otherwise the mid-point of a triangle is on the line
wxPoint GetCentre() const
- { return wxPoint(m_pos.x + m_size.x / 2, m_pos.y + m_size.y / 2); }
-
+ { return wxPoint(m_pos.x + m_size.x / 2 - 1, m_pos.y + m_size.y / 2 - 1); }
+
struct ShapeDump
{
int x, y, // position
dc.DrawLine(p2, p3);
dc.DrawLine(p3, p1);
-#ifdef __WXMSW__
+ //works in multicolor modes; on GTK (at least) will fail in 16-bit color
+ dc.SetBrush(wxBrush(m_col, wxSOLID));
dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER);
-#endif
}
};
dc.DrawLine(p3, p4);
dc.DrawLine(p4, p1);
-#ifdef __WXMSW__
+ dc.SetBrush(wxBrush(m_col, wxSOLID));
dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER);
-#endif
}
};
dc.DrawEllipse(m_pos, m_size);
-#ifdef __WXMSW__
+ dc.SetBrush(wxBrush(m_col, wxSOLID));
dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER);
-#endif
}
};
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() )
{