git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// Represents the application. Derive OnInit and declare
// a new App object to start application
// Represents the application. Derive OnInit and declare
// a new App object to start application
class WXDLLEXPORT wxApp: public wxEvtHandler
{
DECLARE_DYNAMIC_CLASS(wxApp)
class WXDLLEXPORT wxApp: public wxEvtHandler
{
DECLARE_DYNAMIC_CLASS(wxApp)
// No specific tasks to do here.
virtual bool OnInitGui(void) { return TRUE; }
// 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; };
// Called to set off the main loop
virtual int OnRun(void) { return MainLoop(); };
virtual int OnExit(void) { return 0; };
// Compatibility with X's requirements for
// drawing on top of all windows
// 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; }
};
static bool EndDrawingOnTop(void) { return TRUE; }
};
+#define USE_CONFIG 1
+ // Use wxConfig, with CreateConfig in wxApp
#define __GOODCOMPILER__
// gcc can have problems, but Windows compilers
// are generally OK.
#define __GOODCOMPILER__
// gcc can have problems, but Windows compilers
// are generally OK.
//@{
/// find a substring
size_t find(const wxString& str, size_t nStart = 0) const;
//@{
/// 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;
/// find first n characters of sz
size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const;
/// find the first occurence of character ch after nStart
size_t find(char ch, size_t nStart = 0) const;
/// find the first occurence of character ch after nStart
size_t find(char ch, size_t nStart = 0) const;
/// as find, but from the end
size_t rfind(const wxString& str, size_t nStart = npos) const;
/// as find, but from the end
/// 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;
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;
-# 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
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
!include $(WXDIR)\src\makemsc.env
!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
!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
-
-SOURCES = minimal.$(SRCSUFF)
-OBJECTS = minimal.obj
+SOURCES = test.$(SRCSUFF)
+OBJECTS = test.obj
-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
-minimal.obj $(WXDIR)\src\msw\dummy.obj,
-minimal,
+test.obj $(WXDIR)\src\msw\dummy.obj,
+test,
-minimal.obj: minimal.$(SRCSUFF)
+test.obj: test.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(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
<<
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
#endif
#ifdef __WINDOWS__
#endif
#ifdef __WINDOWS__
+#else
+#include <wx/tbarmsw.h>
+#endif
-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):
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)
int offX = 5;
int currentX = 5;
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");
- AddTool(1, bitmaps[1], wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Open file");
+ AddTool(1, *bitmaps[1], wxNullBitmap, FALSE, currentX, -1, NULL, "Open file");
- 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();
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");
- AddTool(4, bitmaps[4], wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Cut");
+ AddTool(4, *bitmaps[4], wxNullBitmap, FALSE, currentX, -1, NULL, "Cut");
- 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();
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();
currentX += width + 5;
AddSeparator();
- AddTool(7, bitmaps[7], wxNullBitmap, TRUE, currentX, -1, NULL, "Help");
+ AddTool(7, *bitmaps[7], wxNullBitmap, TRUE, currentX, -1, NULL, "Help");
void TestRibbon::OnPaint(wxPaintEvent& event)
{
void TestRibbon::OnPaint(wxPaintEvent& event)
{
- wxToolBar95::OnPaint(event);
+ wxToolBar::OnPaint(event);
wxPaintDC dc(this);
int w, h;
GetSize(&w, &h);
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);
}
dc.DrawLine(0, h-1, w, h-1);
}
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
+#ifdef __WINDOWS__
+#ifdef __WIN95__
+#define wxToolBar wxToolBar95
+#else
+#define wxToolBar wxToolBarMSW
+#endif
+#endif
+
// Define a new application
class MyApp: public wxApp
{
// Define a new application
class MyApp: public wxApp
{
-class TestRibbon: public wxToolBar95
+class TestRibbon: public wxToolBar
{
public:
TestRibbon(wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1,
{
public:
TestRibbon(wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1,