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
This commit is contained in:
@@ -42,6 +42,7 @@ bool WXDLLEXPORT wxYield(void);
|
|||||||
|
|
||||||
// Represents the application. Derive OnInit and declare
|
// Represents the application. Derive OnInit and declare
|
||||||
// a new App object to start application
|
// a new App object to start application
|
||||||
|
class wxConfig;
|
||||||
class WXDLLEXPORT wxApp: public wxEvtHandler
|
class WXDLLEXPORT wxApp: public wxEvtHandler
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxApp)
|
DECLARE_DYNAMIC_CLASS(wxApp)
|
||||||
@@ -70,6 +71,10 @@ class WXDLLEXPORT wxApp: public wxEvtHandler
|
|||||||
// No specific tasks to do here.
|
// No specific tasks to do here.
|
||||||
virtual bool OnInitGui(void) { return TRUE; }
|
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
|
// Called to set off the main loop
|
||||||
virtual int OnRun(void) { return MainLoop(); };
|
virtual int OnRun(void) { return MainLoop(); };
|
||||||
virtual int OnExit(void) { return 0; };
|
virtual int OnExit(void) { return 0; };
|
||||||
|
@@ -29,8 +29,8 @@ class WXDLLEXPORT wxScreenDC: public wxDC
|
|||||||
|
|
||||||
// Compatibility with X's requirements for
|
// Compatibility with X's requirements for
|
||||||
// drawing on top of all windows
|
// drawing on top of all windows
|
||||||
static bool StartDrawingOnTop(wxWindow *window) { return TRUE; }
|
static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return TRUE; }
|
||||||
static bool StartDrawingOnTop(wxRectangle *rect = NULL) { return TRUE; }
|
static bool StartDrawingOnTop(wxRectangle* WXUNUSED(rect) = NULL) { return TRUE; }
|
||||||
static bool EndDrawingOnTop(void) { return TRUE; }
|
static bool EndDrawingOnTop(void) { return TRUE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -17,6 +17,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define USE_CONFIG 1
|
||||||
|
// Use wxConfig, with CreateConfig in wxApp
|
||||||
#define __GOODCOMPILER__
|
#define __GOODCOMPILER__
|
||||||
// gcc can have problems, but Windows compilers
|
// gcc can have problems, but Windows compilers
|
||||||
// are generally OK.
|
// are generally OK.
|
||||||
|
@@ -548,8 +548,12 @@ public:
|
|||||||
//@{
|
//@{
|
||||||
/// find a substring
|
/// find a substring
|
||||||
size_t find(const wxString& str, size_t nStart = 0) const;
|
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
|
/// find first n characters of sz
|
||||||
size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const;
|
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
|
/// find the first occurence of character ch after nStart
|
||||||
size_t find(char ch, size_t nStart = 0) const;
|
size_t find(char ch, size_t nStart = 0) const;
|
||||||
|
|
||||||
@@ -565,10 +569,13 @@ public:
|
|||||||
/// as find, but from the end
|
/// as find, but from the end
|
||||||
size_t rfind(const wxString& str, size_t nStart = npos) const;
|
size_t rfind(const wxString& str, size_t nStart = npos) const;
|
||||||
/// as find, but from the end
|
/// 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 rfind(const char* sz, size_t nStart = npos,
|
||||||
size_t n = npos) const;
|
size_t n = npos) const;
|
||||||
/// as find, but from the end
|
/// as find, but from the end
|
||||||
size_t rfind(char ch, size_t nStart = npos) const;
|
size_t rfind(char ch, size_t nStart = npos) const;
|
||||||
|
#endif
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
# "%W% %G%"
|
# "%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
|
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||||
# info
|
# info
|
||||||
|
|
||||||
@@ -15,32 +15,17 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
!include $(WXDIR)\src\makemsc.env
|
!include $(WXDIR)\src\makemsc.env
|
||||||
|
|
||||||
THISDIR = $(WXDIR)\samples\minimal
|
THISDIR = $(WXDIR)\samples\test
|
||||||
WXLIB = $(WXDIR)\lib\wx.lib
|
|
||||||
LIBS=$(WXLIB) oldnames libw llibcew commdlg shell ddeml
|
|
||||||
|
|
||||||
!ifndef FINAL
|
!ifndef FINAL
|
||||||
FINAL=0
|
FINAL=0
|
||||||
!endif
|
!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 =
|
HEADERS =
|
||||||
SOURCES = minimal.$(SRCSUFF)
|
SOURCES = test.$(SRCSUFF)
|
||||||
OBJECTS = minimal.obj
|
OBJECTS = test.obj
|
||||||
|
|
||||||
all: minimal.exe
|
all: test.exe
|
||||||
|
|
||||||
wx:
|
wx:
|
||||||
cd $(WXDIR)\src\msw
|
cd $(WXDIR)\src\msw
|
||||||
@@ -53,24 +38,24 @@ wxclean:
|
|||||||
cd $(THISDIR)
|
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) @<<
|
link $(LINKFLAGS) @<<
|
||||||
minimal.obj $(WXDIR)\src\msw\dummy.obj,
|
test.obj $(WXDIR)\src\msw\dummy.obj,
|
||||||
minimal,
|
test,
|
||||||
NUL,
|
NUL,
|
||||||
$(LIBS),
|
$(LIBS),
|
||||||
minimal.def
|
test.def
|
||||||
;
|
;
|
||||||
<<
|
<<
|
||||||
rc -30 -K minimal.res
|
rc -30 -K test.res
|
||||||
|
|
||||||
minimal.obj: minimal.$(SRCSUFF)
|
test.obj: test.$(SRCSUFF)
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
minimal.res : minimal.rc $(WXDIR)\include\msw\wx.rc
|
test.res : test.rc $(WXDIR)\include\wx\msw\wx.rc
|
||||||
rc -r /dFAFA_LIB /i$(WXDIR)\contrib\fafa /i$(WXDIR)\include\msw minimal
|
rc -r /dFAFA_LIB /i$(WXDIR)\include test
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-erase *.obj
|
-erase *.obj
|
||||||
|
@@ -52,7 +52,7 @@ $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
|||||||
<<
|
<<
|
||||||
|
|
||||||
mdi.res : mdi.rc $(WXDIR)\include\wx\msw\wx.rc
|
mdi.res : mdi.rc $(WXDIR)\include\wx\msw\wx.rc
|
||||||
rc -r /i$(WXDIR)\include mdi
|
rc -r /i$(WXDIR)\include mdi
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-erase *.obj
|
-erase *.obj
|
||||||
|
@@ -22,7 +22,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
#ifdef __WIN95__
|
||||||
#include <wx/tbar95.h>
|
#include <wx/tbar95.h>
|
||||||
|
#else
|
||||||
|
#include <wx/tbarmsw.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mdi.h"
|
#include "mdi.h"
|
||||||
@@ -293,13 +297,13 @@ bool MyChild::OnClose(void)
|
|||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(TestRibbon, wxToolBar95)
|
BEGIN_EVENT_TABLE(TestRibbon, wxToolBar)
|
||||||
EVT_PAINT(TestRibbon::OnPaint)
|
EVT_PAINT(TestRibbon::OnPaint)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
TestRibbon::TestRibbon(wxFrame *frame, int x, int y, int w, int h,
|
TestRibbon::TestRibbon(wxFrame *frame, int x, int y, int w, int h,
|
||||||
long style, int direction, int RowsOrColumns):
|
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];
|
wxBitmap* bitmaps[8];
|
||||||
|
|
||||||
@@ -320,24 +324,24 @@ TestRibbon::TestRibbon(wxFrame *frame, int x, int y, int w, int h,
|
|||||||
int offX = 5;
|
int offX = 5;
|
||||||
int currentX = 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;
|
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;
|
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;
|
currentX += width + 5;
|
||||||
AddSeparator();
|
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;
|
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;
|
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;
|
currentX += width + 5;
|
||||||
AddSeparator();
|
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;
|
currentX += width + 5;
|
||||||
AddSeparator();
|
AddSeparator();
|
||||||
AddTool(7, bitmaps[7], wxNullBitmap, TRUE, currentX, -1, NULL, "Help");
|
AddTool(7, *bitmaps[7], wxNullBitmap, TRUE, currentX, -1, NULL, "Help");
|
||||||
|
|
||||||
CreateTools();
|
CreateTools();
|
||||||
|
|
||||||
@@ -367,14 +371,14 @@ void TestRibbon::OnMouseEnter(int toolIndex)
|
|||||||
|
|
||||||
void TestRibbon::OnPaint(wxPaintEvent& event)
|
void TestRibbon::OnPaint(wxPaintEvent& event)
|
||||||
{
|
{
|
||||||
wxToolBar95::OnPaint(event);
|
wxToolBar::OnPaint(event);
|
||||||
|
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
GetSize(&w, &h);
|
GetSize(&w, &h);
|
||||||
dc.SetPen(wxBLACK_PEN);
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
dc.SetBrush(wxTRANSPARENT_BRUSH);
|
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||||
dc.DrawLine(0, h-1, w, h-1);
|
dc.DrawLine(0, h-1, w, h-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,14 @@
|
|||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
#ifdef __WIN95__
|
||||||
|
#define wxToolBar wxToolBar95
|
||||||
|
#else
|
||||||
|
#define wxToolBar wxToolBarMSW
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Define a new application
|
// Define a new application
|
||||||
class MyApp: public wxApp
|
class MyApp: public wxApp
|
||||||
{
|
{
|
||||||
@@ -28,7 +36,7 @@ class MyCanvas: public wxScrolledWindow
|
|||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
|
||||||
class TestRibbon: public wxToolBar95
|
class TestRibbon: public wxToolBar
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TestRibbon(wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1,
|
TestRibbon(wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1,
|
||||||
|
Reference in New Issue
Block a user