More SC++ fixes; HelpGen starting to compile with VC++; image sample now compiles/runs
with VC++ git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1357 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -7,7 +7,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/image.h"
|
||||
|
||||
// derived classes
|
||||
@@ -77,6 +87,8 @@ END_EVENT_TABLE()
|
||||
MyCanvas::MyCanvas( wxWindow *parent, const wxWindowID id, const wxPoint &pos, const wxSize &size )
|
||||
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER )
|
||||
{
|
||||
SetBackgroundColour(* wxWHITE);
|
||||
|
||||
wxBitmap bitmap( 100, 100 );
|
||||
|
||||
wxMemoryDC dc;
|
||||
@@ -85,14 +97,20 @@ MyCanvas::MyCanvas( wxWindow *parent, const wxWindowID id, const wxPoint &pos, c
|
||||
dc.SetPen( *wxWHITE_PEN );
|
||||
dc.DrawRectangle( 0, 0, 100, 100 );
|
||||
dc.SelectObject( wxNullBitmap );
|
||||
|
||||
|
||||
wxString dir("");
|
||||
|
||||
#ifdef __WXGTK__
|
||||
dir = wxString("../");
|
||||
#endif
|
||||
|
||||
wxImage image( bitmap );
|
||||
image.SaveFile( "../test.png", wxBITMAP_TYPE_PNG );
|
||||
image.SaveFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
|
||||
|
||||
image.LoadFile( "../horse.png", wxBITMAP_TYPE_PNG );
|
||||
image.LoadFile( dir + wxString("horse.png"), wxBITMAP_TYPE_PNG );
|
||||
my_horse = new wxBitmap( image.ConvertToBitmap() );
|
||||
|
||||
image.LoadFile( "../test.png", wxBITMAP_TYPE_PNG );
|
||||
image.LoadFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
|
||||
my_square = new wxBitmap( image.ConvertToBitmap() );
|
||||
}
|
||||
|
||||
@@ -140,8 +158,7 @@ MyFrame::MyFrame(void) :
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar();
|
||||
menu_bar->Append(file_menu, "File");
|
||||
menu_bar->Show( TRUE );
|
||||
|
||||
|
||||
SetMenuBar( menu_bar );
|
||||
|
||||
CreateStatusBar(2);
|
||||
@@ -166,7 +183,8 @@ void MyFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
{
|
||||
int w,h;
|
||||
GetClientSize( &w, &h );
|
||||
m_canvas->SetSize( w, h );
|
||||
if (m_canvas)
|
||||
m_canvas->SetSize( w, h );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -188,7 +206,3 @@ bool MyApp::OnInit(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
3
samples/image/image.rc
Normal file
3
samples/image/image.rc
Normal file
@@ -0,0 +1,3 @@
|
||||
/* mondrian ICON "mondrian.ico" */
|
||||
#include "wx/msw/wx.rc"
|
||||
|
64
samples/image/makefile.nt
Normal file
64
samples/image/makefile.nt
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds image example (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
WXUSINGDLL=0
|
||||
|
||||
!include $(WXDIR)\src\ntwxwin.mak
|
||||
|
||||
THISDIR = $(WXDIR)\samples\image
|
||||
PROGRAM=image
|
||||
|
||||
OBJECTS = $(PROGRAM).obj
|
||||
|
||||
$(PROGRAM): $(PROGRAM).exe
|
||||
|
||||
all: wx $(PROGRAM).exe
|
||||
|
||||
wx:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.nt FINAL=$(FINAL)
|
||||
cd $(THISDIR)
|
||||
|
||||
wxclean:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.nt clean
|
||||
cd $(THISDIR)
|
||||
|
||||
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
|
||||
$(link) @<<
|
||||
-out:$(PROGRAM).exe
|
||||
$(LINKFLAGS)
|
||||
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
|
||||
$(LIBS)
|
||||
<<
|
||||
|
||||
|
||||
$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
|
||||
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
Reference in New Issue
Block a user