git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34164
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
cp $(SAMPDIR)/rotate/Makefile.in $(DISTDIR)/samples/rotate
cp $(SAMPDIR)/rotate/makefile.unx $(DISTDIR)/samples/rotate
cp $(SAMPDIR)/rotate/*.cpp $(DISTDIR)/samples/rotate
cp $(SAMPDIR)/rotate/Makefile.in $(DISTDIR)/samples/rotate
cp $(SAMPDIR)/rotate/makefile.unx $(DISTDIR)/samples/rotate
cp $(SAMPDIR)/rotate/*.cpp $(DISTDIR)/samples/rotate
- cp $(SAMPDIR)/rotate/*.bmp $(DISTDIR)/samples/rotate
+ cp $(SAMPDIR)/rotate/*.png $(DISTDIR)/samples/rotate
mkdir $(DISTDIR)/samples/richedit
cp $(SAMPDIR)/richedit/Makefile.in $(DISTDIR)/samples/richedit
mkdir $(DISTDIR)/samples/richedit
cp $(SAMPDIR)/richedit/Makefile.in $(DISTDIR)/samples/richedit
cp $(SAMPDIR)/rotate/Makefile.in $(DISTDIR)/samples/rotate
cp $(SAMPDIR)/rotate/makefile.unx $(DISTDIR)/samples/rotate
cp $(SAMPDIR)/rotate/*.cpp $(DISTDIR)/samples/rotate
cp $(SAMPDIR)/rotate/Makefile.in $(DISTDIR)/samples/rotate
cp $(SAMPDIR)/rotate/makefile.unx $(DISTDIR)/samples/rotate
cp $(SAMPDIR)/rotate/*.cpp $(DISTDIR)/samples/rotate
- cp $(SAMPDIR)/rotate/*.bmp $(DISTDIR)/samples/rotate
+ cp $(SAMPDIR)/rotate/*.png $(DISTDIR)/samples/rotate
mkdir $(DISTDIR)/samples/richedit
cp $(SAMPDIR)/richedit/Makefile.in $(DISTDIR)/samples/richedit
mkdir $(DISTDIR)/samples/richedit
cp $(SAMPDIR)/richedit/Makefile.in $(DISTDIR)/samples/richedit
- @for f in kclub.bmp; do \
+ @for f in duck.png; do \
if test ! -f ./$$f ; \
then x=yep ; \
else x=`find $(srcdir)/$$f -newer ./$$f -print` ; \
if test ! -f ./$$f ; \
then x=yep ; \
else x=`find $(srcdir)/$$f -newer ./$$f -print` ; \
data:
if not exist $(OBJS) mkdir $(OBJS)
data:
if not exist $(OBJS) mkdir $(OBJS)
- for %f in (kclub.bmp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
+ for %f in (duck.png) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
$(OBJS)\rotate_rotate.obj: .\rotate.cpp
$(CXX) -q -c -P -o$@ $(ROTATE_CXXFLAGS) $**
$(OBJS)\rotate_rotate.obj: .\rotate.cpp
$(CXX) -q -c -P -o$@ $(ROTATE_CXXFLAGS) $**
data:
if not exist $(OBJS) mkdir $(OBJS)
data:
if not exist $(OBJS) mkdir $(OBJS)
- for %%f in (kclub.bmp) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
+ for %%f in (duck.png) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
$(OBJS)\rotate_rotate.o: ./rotate.cpp
$(CXX) -c -o $@ $(ROTATE_CXXFLAGS) $<
$(OBJS)\rotate_rotate.o: ./rotate.cpp
$(CXX) -c -o $@ $(ROTATE_CXXFLAGS) $<
data:
if not exist $(OBJS) mkdir $(OBJS)
data:
if not exist $(OBJS) mkdir $(OBJS)
- for %f in (kclub.bmp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
+ for %f in (duck.png) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
$(OBJS)\rotate_rotate.obj: .\rotate.cpp
$(CXX) /c /nologo /TP /Fo$@ $(ROTATE_CXXFLAGS) $**
$(OBJS)\rotate_rotate.obj: .\rotate.cpp
$(CXX) /c /nologo /TP /Fo$@ $(ROTATE_CXXFLAGS) $**
data : .SYMBOLIC
if not exist $(OBJS) mkdir $(OBJS)
data : .SYMBOLIC
if not exist $(OBJS) mkdir $(OBJS)
- for %f in (kclub.bmp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
+ for %f in (duck.png) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
$(OBJS)\rotate_rotate.obj : .AUTODEPEND .\rotate.cpp
$(CXX) -zq -fo=$^@ $(ROTATE_CXXFLAGS) $<
$(OBJS)\rotate_rotate.obj : .AUTODEPEND .\rotate.cpp
$(CXX) -zq -fo=$^@ $(ROTATE_CXXFLAGS) $<
<wx-data id="data">
<files>
<wx-data id="data">
<files>
};
// ----------------------------------------------------------------------------
};
// ----------------------------------------------------------------------------
-// data class for cards that need to be rendered
+// data class for images that need to be rendered
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
- MyRenderedCard(const wxBitmap& bmp, int x, int y)
+ MyRenderedImage(const wxBitmap& bmp, int x, int y)
: m_bmp(bmp), m_x(x), m_y(y) { }
wxBitmap m_bmp;
int m_x, m_y;
};
: m_bmp(bmp), m_x(x), m_y(y) { }
wxBitmap m_bmp;
int m_x, m_y;
};
-// Declare a wxArray type to hold MyRenderedCards.
-WX_DECLARE_OBJARRAY(MyRenderedCard, ArrayOfCards);
+// Declare a wxArray type to hold MyRenderedImages.
+WX_DECLARE_OBJARRAY(MyRenderedImage, ArrayOfImages);
// ----------------------------------------------------------------------------
// custom canvas control that we can draw on
// ----------------------------------------------------------------------------
// custom canvas control that we can draw on
public:
MyCanvas(wxWindow* parent);
public:
MyCanvas(wxWindow* parent);
void OnMouseLeftUp (wxMouseEvent & event);
void OnMouseRightUp (wxMouseEvent & event);
void OnPaint (wxPaintEvent & event);
private:
void OnMouseLeftUp (wxMouseEvent & event);
void OnMouseRightUp (wxMouseEvent & event);
void OnPaint (wxPaintEvent & event);
private:
+ ArrayOfImages m_images;
- m_image = wxImage(_T("kclub.bmp"), wxBITMAP_TYPE_BMP);
+#if wxUSE_LIBPNG
+ wxImage::AddHandler( new wxPNGHandler );
+#endif
- // any unused colour will do
- m_image.SetMaskColour( 0, 255, 255 );
+ m_image = wxImage(_T("duck.png"), wxBITMAP_TYPE_PNG);
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
-// data class for cards that need to be rendered
+// data class for images that need to be rendered
// ----------------------------------------------------------------------------
#include "wx/arrimpl.cpp"
// ----------------------------------------------------------------------------
#include "wx/arrimpl.cpp"
-WX_DEFINE_OBJARRAY(ArrayOfCards);
+WX_DEFINE_OBJARRAY(ArrayOfImages);
// ----------------------------------------------------------------------------
// custom canvas control that we can draw on
// ----------------------------------------------------------------------------
// custom canvas control that we can draw on
-void MyCanvas::ClearCards ()
+void MyCanvas::ClearImages ()
wxImage img2 = img.Rotate(frame->m_angle,
wxPoint(img.GetWidth() / 2, img.GetHeight() / 2), true, &offset);
wxImage img2 = img.Rotate(frame->m_angle,
wxPoint(img.GetWidth() / 2, img.GetHeight() / 2), true, &offset);
- // Add the cards to an array to be drawn later in OnPaint()
- m_cards.Add(new MyRenderedCard(wxBitmap(img2),
+ // Add the images to an array to be drawn later in OnPaint()
+ m_images.Add(new MyRenderedImage(wxBitmap(img2),
event.m_x + offset.x, event.m_y + offset.y));
Refresh(false);
}
event.m_x + offset.x, event.m_y + offset.y));
Refresh(false);
}
wxImage img2 = img.Rotate(frame->m_angle,
wxPoint(img.GetWidth() / 2, img.GetHeight() / 2), false);
wxImage img2 = img.Rotate(frame->m_angle,
wxPoint(img.GetWidth() / 2, img.GetHeight() / 2), false);
- // Add the cards to an array to be drawn later in OnPaint()
- m_cards.Add(new MyRenderedCard(wxBitmap(img2), event.m_x, event.m_y));
+ // Add the images to an array to be drawn later in OnPaint()
+ m_images.Add(new MyRenderedImage(wxBitmap(img2), event.m_x, event.m_y));
Refresh(false);
}
void MyCanvas::OnPaint (wxPaintEvent &)
{
Refresh(false);
}
void MyCanvas::OnPaint (wxPaintEvent &)
{
- size_t numCards = m_cards.GetCount();
+ size_t numImages = m_images.GetCount();
wxPaintDC dc(this);
dc.BeginDrawing();
dc.SetTextForeground(wxColour(255, 255, 255));
wxPaintDC dc(this);
dc.BeginDrawing();
dc.SetTextForeground(wxColour(255, 255, 255));
- dc.DrawText(wxT("Click on the canvas to draw a card."), 10, 10);
+ dc.DrawText(wxT("Click on the canvas to draw a duck."), 10, 10);
- for (size_t i = 0; i < numCards; i++) {
- MyRenderedCard & card = m_cards.Item(i);
- dc.DrawBitmap(card.m_bmp, card.m_x, card.m_y, true);
+ for (size_t i = 0; i < numImages; i++) {
+ MyRenderedImage & image = m_images.Item(i);
+ dc.DrawBitmap(image.m_bmp, image.m_x, image.m_y, true);
wxMenu *menuFile = new wxMenu;
menuFile->Append (ID_Angle, _T("Set &angle...\tCtrl-A"));
wxMenu *menuFile = new wxMenu;
menuFile->Append (ID_Angle, _T("Set &angle...\tCtrl-A"));
- menuFile->Append (ID_Clear, _T("&Clear all cards\tCtrl-C"));
+ menuFile->Append (ID_Clear, _T("&Clear all ducks\tCtrl-C"));
menuFile->AppendSeparator();
menuFile->Append (ID_Quit, _T("E&xit\tAlt-X"));
menuFile->AppendSeparator();
menuFile->Append (ID_Quit, _T("E&xit\tAlt-X"));
void MyFrame::OnClear (wxCommandEvent &)
{
void MyFrame::OnClear (wxCommandEvent &)
{
- m_canvas->ClearCards ();
+ m_canvas->ClearImages ();