From 6b0eb19fe80af6e2aa598afc84eb052cf2d8ddd9 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 27 May 1998 13:56:59 +0000 Subject: [PATCH] Misc changes for DOS compatibility, plus added wxApp::CreateConfig git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/app.h | 5 +++++ include/wx/msw/dcscreen.h | 4 ++-- include/wx/msw/setup.h | 2 ++ include/wx/string.h | 7 +++++++ samples/grid/makefile.dos | 41 +++++++++++++-------------------------- samples/mdi/makefile.dos | 2 +- samples/mdi/mdi.cpp | 30 +++++++++++++++------------- samples/mdi/mdi.h | 10 +++++++++- 8 files changed, 56 insertions(+), 45 deletions(-) diff --git a/include/wx/msw/app.h b/include/wx/msw/app.h index 8fe8d12248..15eeaca9a1 100644 --- a/include/wx/msw/app.h +++ b/include/wx/msw/app.h @@ -42,6 +42,7 @@ bool WXDLLEXPORT wxYield(void); // Represents the application. Derive OnInit and declare // a new App object to start application +class wxConfig; class WXDLLEXPORT wxApp: public wxEvtHandler { DECLARE_DYNAMIC_CLASS(wxApp) @@ -70,6 +71,10 @@ class WXDLLEXPORT wxApp: public wxEvtHandler // No specific tasks to do here. virtual bool OnInitGui(void) { return TRUE; } + // override this function to create a global wxConfig object of different + // than default type (right now the default implementation returns NULL) + virtual wxConfig *CreateConfig(void) { return NULL; } + // Called to set off the main loop virtual int OnRun(void) { return MainLoop(); }; virtual int OnExit(void) { return 0; }; diff --git a/include/wx/msw/dcscreen.h b/include/wx/msw/dcscreen.h index 16c1528169..09d1ac51d0 100644 --- a/include/wx/msw/dcscreen.h +++ b/include/wx/msw/dcscreen.h @@ -29,8 +29,8 @@ class WXDLLEXPORT wxScreenDC: public wxDC // Compatibility with X's requirements for // drawing on top of all windows - static bool StartDrawingOnTop(wxWindow *window) { return TRUE; } - static bool StartDrawingOnTop(wxRectangle *rect = NULL) { return TRUE; } + static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return TRUE; } + static bool StartDrawingOnTop(wxRectangle* WXUNUSED(rect) = NULL) { return TRUE; } static bool EndDrawingOnTop(void) { return TRUE; } }; diff --git a/include/wx/msw/setup.h b/include/wx/msw/setup.h index 9c6c7c8028..77e1649801 100644 --- a/include/wx/msw/setup.h +++ b/include/wx/msw/setup.h @@ -17,6 +17,8 @@ * */ +#define USE_CONFIG 1 + // Use wxConfig, with CreateConfig in wxApp #define __GOODCOMPILER__ // gcc can have problems, but Windows compilers // are generally OK. diff --git a/include/wx/string.h b/include/wx/string.h index 55b4812624..0b413e841f 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -548,8 +548,12 @@ public: //@{ /// find a substring size_t find(const wxString& str, size_t nStart = 0) const; + + // VC++ 1.5 can't cope with this syntax. +#if ! (defined(_MSC_VER) && !defined(__WIN32__)) /// find first n characters of sz size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const; +#endif /// find the first occurence of character ch after nStart size_t find(char ch, size_t nStart = 0) const; @@ -565,10 +569,13 @@ public: /// as find, but from the end size_t rfind(const wxString& str, size_t nStart = npos) const; /// as find, but from the end + // VC++ 1.5 can't cope with this syntax. +#if ! (defined(_MSC_VER) && !defined(__WIN32__)) size_t rfind(const char* sz, size_t nStart = npos, size_t n = npos) const; /// as find, but from the end size_t rfind(char ch, size_t nStart = npos) const; +#endif //@} /** diff --git a/samples/grid/makefile.dos b/samples/grid/makefile.dos index 5b65a93c36..23a7e87223 100644 --- a/samples/grid/makefile.dos +++ b/samples/grid/makefile.dos @@ -7,7 +7,7 @@ # # "%W% %G%" # -# Makefile : Builds minimal example (DOS). +# Makefile : Builds grid test example (DOS). # Use FINAL=1 argument to nmake to build final version with no debugging # info @@ -15,32 +15,17 @@ WXDIR = $(WXWIN) !include $(WXDIR)\src\makemsc.env -THISDIR = $(WXDIR)\samples\minimal -WXLIB = $(WXDIR)\lib\wx.lib -LIBS=$(WXLIB) oldnames libw llibcew commdlg shell ddeml +THISDIR = $(WXDIR)\samples\test !ifndef FINAL FINAL=0 !endif -INC=/I$(WXDIR)\include\msw /I$(WXDIR)\include\base - -# Set this to nothing if using MS C++ 7 -ZOPTION=/Z7 - -!if "$(FINAL)" == "0" -CPPFLAGS=/AL /W3 /Zi $(ZOPTION) /G2sw /Od /YuWX_PREC.H /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch $(INC) -LINKFLAGS=/NOD /CO /ONERROR:NOEXE /SEG:512 -!else -CPPFLAGS=/AL /W3 /G2sw /Ox /YuWX_PREC.H /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch $(INC) -LINKFLAGS=/NOD /ONERROR:NOEXE /SEG:512 -!endif - HEADERS = -SOURCES = minimal.$(SRCSUFF) -OBJECTS = minimal.obj +SOURCES = test.$(SRCSUFF) +OBJECTS = test.obj -all: minimal.exe +all: test.exe wx: cd $(WXDIR)\src\msw @@ -53,24 +38,24 @@ wxclean: cd $(THISDIR) -minimal.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) minimal.obj minimal.def minimal.res +test.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) test.obj test.def test.res link $(LINKFLAGS) @<< -minimal.obj $(WXDIR)\src\msw\dummy.obj, -minimal, +test.obj $(WXDIR)\src\msw\dummy.obj, +test, NUL, $(LIBS), -minimal.def +test.def ; << - rc -30 -K minimal.res + rc -30 -K test.res -minimal.obj: minimal.$(SRCSUFF) +test.obj: test.$(SRCSUFF) cl @<< $(CPPFLAGS) /c /Tp $*.$(SRCSUFF) << -minimal.res : minimal.rc $(WXDIR)\include\msw\wx.rc - rc -r /dFAFA_LIB /i$(WXDIR)\contrib\fafa /i$(WXDIR)\include\msw minimal +test.res : test.rc $(WXDIR)\include\wx\msw\wx.rc + rc -r /dFAFA_LIB /i$(WXDIR)\include test clean: -erase *.obj diff --git a/samples/mdi/makefile.dos b/samples/mdi/makefile.dos index ee2b9154b3..1bd3983dc8 100644 --- a/samples/mdi/makefile.dos +++ b/samples/mdi/makefile.dos @@ -52,7 +52,7 @@ $(CPPFLAGS) /c /Tp $*.$(SRCSUFF) << mdi.res : mdi.rc $(WXDIR)\include\wx\msw\wx.rc - rc -r /i$(WXDIR)\include mdi + rc -r /i$(WXDIR)\include mdi clean: -erase *.obj diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp index 217d943ab0..c9d49661ea 100644 --- a/samples/mdi/mdi.cpp +++ b/samples/mdi/mdi.cpp @@ -22,7 +22,11 @@ #endif #ifdef __WINDOWS__ +#ifdef __WIN95__ #include +#else +#include +#endif #endif #include "mdi.h" @@ -293,13 +297,13 @@ bool MyChild::OnClose(void) #ifdef __WINDOWS__ -BEGIN_EVENT_TABLE(TestRibbon, wxToolBar95) +BEGIN_EVENT_TABLE(TestRibbon, wxToolBar) EVT_PAINT(TestRibbon::OnPaint) END_EVENT_TABLE() TestRibbon::TestRibbon(wxFrame *frame, int x, int y, int w, int h, long style, int direction, int RowsOrColumns): - wxToolBar95(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns) + wxToolBar(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns) { wxBitmap* bitmaps[8]; @@ -320,24 +324,24 @@ TestRibbon::TestRibbon(wxFrame *frame, int x, int y, int w, int h, int offX = 5; int currentX = 5; - AddTool(0, bitmaps[0], wxNullBitmap, FALSE, (float)currentX, -1, NULL, "New file"); + AddTool(0, *bitmaps[0], wxNullBitmap, FALSE, currentX, -1, NULL, "New file"); currentX += width + 5; - AddTool(1, bitmaps[1], wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Open file"); + AddTool(1, *bitmaps[1], wxNullBitmap, FALSE, currentX, -1, NULL, "Open file"); currentX += width + 5; - AddTool(2, bitmaps[2], wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Save file"); + AddTool(2, *bitmaps[2], wxNullBitmap, FALSE, currentX, -1, NULL, "Save file"); currentX += width + 5; AddSeparator(); - AddTool(3, bitmaps[3], wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Copy"); + AddTool(3, *bitmaps[3], wxNullBitmap, FALSE, currentX, -1, NULL, "Copy"); currentX += width + 5; - AddTool(4, bitmaps[4], wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Cut"); + AddTool(4, *bitmaps[4], wxNullBitmap, FALSE, currentX, -1, NULL, "Cut"); currentX += width + 5; - AddTool(5, bitmaps[5], wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Paste"); + AddTool(5, *bitmaps[5], wxNullBitmap, FALSE, currentX, -1, NULL, "Paste"); currentX += width + 5; AddSeparator(); - AddTool(6, bitmaps[6], wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Print"); + AddTool(6, *bitmaps[6], wxNullBitmap, FALSE, currentX, -1, NULL, "Print"); currentX += width + 5; AddSeparator(); - AddTool(7, bitmaps[7], wxNullBitmap, TRUE, currentX, -1, NULL, "Help"); + AddTool(7, *bitmaps[7], wxNullBitmap, TRUE, currentX, -1, NULL, "Help"); CreateTools(); @@ -367,14 +371,14 @@ void TestRibbon::OnMouseEnter(int toolIndex) void TestRibbon::OnPaint(wxPaintEvent& event) { - wxToolBar95::OnPaint(event); + wxToolBar::OnPaint(event); wxPaintDC dc(this); int w, h; GetSize(&w, &h); - dc.SetPen(wxBLACK_PEN); - dc.SetBrush(wxTRANSPARENT_BRUSH); + dc.SetPen(*wxBLACK_PEN); + dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawLine(0, h-1, w, h-1); } diff --git a/samples/mdi/mdi.h b/samples/mdi/mdi.h index 073eac04e1..e33dd98f12 100644 --- a/samples/mdi/mdi.h +++ b/samples/mdi/mdi.h @@ -9,6 +9,14 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +#ifdef __WINDOWS__ +#ifdef __WIN95__ +#define wxToolBar wxToolBar95 +#else +#define wxToolBar wxToolBarMSW +#endif +#endif + // Define a new application class MyApp: public wxApp { @@ -28,7 +36,7 @@ class MyCanvas: public wxScrolledWindow #ifdef __WINDOWS__ -class TestRibbon: public wxToolBar95 +class TestRibbon: public wxToolBar { public: TestRibbon(wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1, -- 2.47.2