next if $wxHTML{$file} =~ /\b16\b/;
$project{"WXHTMLSRCS"} .= $file . " "
}
+
+ if ( Config("wxnodir") ) {
+ $WXDIR = ".";
+ }
+ else {
+ if ( $ENV{'wx'} ) { $WXDIR = "\$(wx)"; }
+ else { $WXDIR = "\$(WXWIN)"; }
+ }
#$}
# Microsoft Developer Studio Project File - Name="wxWindows" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MT" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /Zi /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /I "$(wx)\src\jpeg" /I "$(wx)\src\png" /I "$(wx)\src\tiff" /D "NDEBUG" /D wxUSE_GUI=1 /D WIN95=1 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN32__" /D "_MT" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MD /W4 /Zi /O2 /I #$ $text = "\"$WXDIR\\include\" /I \"$WXDIR\\src\\zlib\" /I \"$WXDIR\\src\\jpeg\" /I \"$WXDIR\\src\\png\" /I \"$WXDIR\\src\\tiff\" /D \"NDEBUG\" /D wxUSE_GUI=1 /D WIN95=1 /D \"__WIN95__\" /D \"WIN32\" /D \"_WIN32\" /D WINVER=0x400 /D \"__WINDOWS__\" /D \"__WXMSW__\" /D \"__WIN32__\" /D \"_MT\" /Yu\"wx/wxprec.h\" /FD /c"
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" -D "_MT" /YX /FD /c
-# ADD CPP /nologo /MDd /W4 /Zi /Od /I "$(wx)\include" /I "$(wx)\src\zlib" /I "$(wx)\src\jpeg" /I "$(wx)\src\png" /I "$(wx)\src\tiff" /D "_DEBUG" /D DEBUG=1 /D WXDEBUG=1 /D "__WXDEBUG__" /D wxUSE_GUI=1 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WIN32__" /D "__WXMSW__" /Fr /D "_MT" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I #$ $text = "\"$WXDIR\\include\" /I \"$WXDIR\\src\\zlib\" /I \"$WXDIR\\src\\jpeg\" /I \"$WXDIR\\src\\png\" /I \"$WXDIR\\src\\tiff\" /D \"_DEBUG\" /D DEBUG=1 /D WXDEBUG=1 /D \"__WXDEBUG__\" /D wxUSE_GUI=1 /D \"__WIN95__\" /D \"WIN32\" /D \"_WIN32\" /D WINVER=0x400 /D \"__WINDOWS__\" /D \"__WIN32__\" /D \"__WXMSW__\" /Fr /D \"_MT\" /Yu\"wx/wxprec.h\" /FD /c"
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
!IF "$(CFG)" == "wxWindows - Win32 Release"
+# ADD CPP /W1 /D "USE_DEFINE"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "wxWindows - Win32 Debug"
-# ADD CPP /W1
+# ADD CPP /W1 /D "USE_DEFINE"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
Project('CONFIG += wx');
}
if ( Config("wx") ) {
- #! VC 6.0 supports env vars in include path
- #! $WXDIR = $ENV{'WX'};
- if ( $ENV{'wx'} ) { $WXDIR = "\$(wx)"; }
- else { $WXDIR = "\$(WXWIN)"; }
- $TMAKE_INCDIR_WX = $WXDIR . "\\include";
- AddIncludePath($TMAKE_INCDIR_WX);
+ if ( Config("wxnodir") ) {
+ $WXDIR = "..\\..";
+ }
+ else {
+ #! VC 6.0 supports env vars in include path
+ #! $WXDIR = $ENV{'WX'};
+ if ( $ENV{'wx'} ) { $WXDIR = "\$(wx)"; }
+ else { $WXDIR = "\$(WXWIN)"; }
+ }
+
+ AddIncludePath($WXDIR . "\\include");
+ }
+
+ if ( Config("unicode") ) {
+ $UNICODE="Unicode";
+ $UNICODE_SUFFIX="u";
+ $UNICODE_FLAGS="/D _UNICODE /D UNICODE ";
+
+ $project{"TARGET"} .= "Unicode";
+ $project{"MAKEFILE"} .= "Unicode";
+ }
+ else {
+ $UNICODE="";
+ $UNICODE_SUFFIX="";
+ $UNICODE_FLAGS=" ";
}
if ( Config("dll") ) {
$DLL="Dll";
- $DLL_SUFFIX="d";
+ $DEBUG_SUFFIX="d";
$DLL_OR_LIB=(Config("wxbase") ? "wxbase" : "wxmsw") . "221";
$DLL_FLAGS="/D WXUSINGDLL ";
$EXTRA_LIBS="";
+
+ $project{"TARGET"} .= "Dll";
+ $project{"MAKEFILE"} .= "Dll";
}
else {
$DLL="";
- $DLL_SUFFIX="";
- $DLL_OR_LIB="wxWindows";
+ $DEBUG_SUFFIX="";
+ $DLL_OR_LIB=Config("wxbase") ? "wxBase" : "wxWindows";
$DLL_FLAGS=" ";
#! actually this depends on the contents of setup.h
$EXTRA_LIBS=Config("wxbase") ? "" : "xpm zlib png jpeg tiff";
if ( Config("wx") ) {
$vc_base_libs .= "comctl32.lib rpcrt4.lib wsock32.lib ";
- $vc_link_release = "$WXDIR\\Release$DLL\\$DLL_OR_LIB.lib ";
- $vc_link_debug = "$WXDIR\\Debug$DLL\\$DLL_OR_LIB$DLL_SUFFIX.lib ";
+ $vc_link_release = "$WXDIR\\Release$UNICODE$DLL\\$DLL_OR_LIB$UNICODE_SUFFIX.lib ";
+ $vc_link_debug = "$WXDIR\\Debug$UNICODE$DLL\\$DLL_OR_LIB$UNICODE_SUFFIX$DEBUG_SUFFIX.lib ";
foreach ( split(/ /, $EXTRA_LIBS) ) {
$vc_link_release .= "$WXDIR\\src\\$_\\Release\\$_.lib ";
$vc_link_debug .= "$WXDIR\\src\\$_\\Debug\\$_.lib ";
$vc_link_release .= '/nologo /subsystem:windows /machine:I386';
$vc_link_debug .= '/nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept';
- foreach ( split(/ /, Project('LIBPATH')) ) {
- $vc_link_release .= " /libpath:$_\\Release";
- $vc_link_debug .= " /libpath:$_\\Debug";
- }
-
- $vc_cpp_def_common = '/D "WIN32" /D "_WINDOWS" ' . $DLL_FLAGS;
+ $vc_cpp_def_common = '/D "WIN32" /D "_WINDOWS" ' . $UNICODE_FLAGS . $DLL_FLAGS;
$vc_cpp_def_release = '/D "NDEBUG" ' . $vc_cpp_def_common;
$vc_cpp_def_debug = '/D "_DEBUG" ' . $vc_cpp_def_common;
} else {
$vc_base_libs = 'kernel32.lib user32.lib advapi32.lib ';
if ( Config("wx") ) {
$vc_base_libs .= 'wsock32.lib ';
- $vc_link_release = "$WXDIR\\Base${DLL}Release\\$DLL_OR_LIB.lib ";
- $vc_link_debug = "$WXDIR\\Base${DLL}Debug\\$DLL_OR_LIB" . "d.lib ";
+ $vc_link_release = "$WXDIR\\BaseRelease$UNICODE$DLL\\$DLL_OR_LIB$UNICODE_SUFFIX.lib ";
+ $vc_link_debug = "$WXDIR\\BaseDebug$UNICODE$DLL\\$DLL_OR_LIB$UNICODE_SUFFIX$DEBUG_SUFFIX.lib ";
}
$vc_link_release .= '/nologo /subsystem:console /machine:I386';
$vc_link_debug .= '/nologo /subsystem:console /debug /machine:I386 /pdbtype:sept';
- $vc_cpp_def_common = '/D "WIN32" /D "_CONSOLE" ' . $DLL_FLAGS;
+ $vc_cpp_def_common = '/D "WIN32" /D "_CONSOLE" ' . $UNICODE_FLAGS . $DLL_FLAGS;
$vc_cpp_def_release = '/D "NDEBUG" ' . $vc_cpp_def_common;
$vc_cpp_def_debug = '/D "_DEBUG" ' . $vc_cpp_def_common;
}
+
+ foreach ( split(/ /, Project('LIBPATH')) ) {
+ $vc_link_release .= " /libpath:$_\\Release";
+ $vc_link_debug .= " /libpath:$_\\Debug";
+ }
+
#! define wxWin debug flags in debug build
if ( Config("wx") ) {
$vc_cpp_def_debug .= '/MDd /D "__WXDEBUG__" /D "WXDEBUG=1" ';
}
#! else: disable C++ exception handling for wxWindows
- $vc_cpp_opt_release = $vc_cpp_opt_common1 . '/O2 ';
+ $vc_cpp_opt_release = $vc_cpp_opt_common1 . '/O1 ';
$vc_cpp_opt_debug = $vc_cpp_opt_common1 . '/Zi /Od ';
$vc_cpp_opt_common = '/YX /FD /c';
$project{"VC_BASE_CPP_RELEASE"} = $vc_cpp_opt_release . $vc_cpp_def_release . $vc_cpp_opt_common;
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release#$ $text = "$DLL" . '"'
-# PROP BASE Intermediate_Dir "Release#$ $text = "$DLL" . '"'
+# PROP BASE Output_Dir "Release#$ $text = "$UNICODE$DLL" . '"'
+# PROP BASE Intermediate_Dir "Release#$ $text = "$UNICODE$DLL" . '"'
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release#$ $text = "$DLL" . '"'
-# PROP Intermediate_Dir "Release#$ $text = "$DLL" . '"'
+# PROP Output_Dir "Release#$ $text = "$UNICODE$DLL" . '"'
+# PROP Intermediate_Dir "Release#$ $text = "$UNICODE$DLL" . '"'
#$ Config("windows") && ($text='# PROP Ignore_Export_Lib 0');
# PROP Target_Dir ""
# ADD BASE CPP #$ Expand("VC_BASE_CPP_RELEASE");
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug#$ $text = "$DLL" . '"'
-# PROP BASE Intermediate_Dir "Debug#$ $text = "$DLL" . '"'
+# PROP BASE Output_Dir "Debug#$ $text = "$UNICODE$DLL" . '"'
+# PROP BASE Intermediate_Dir "Debug#$ $text = "$UNICODE$DLL" . '"'
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug#$ $text = "$DLL" . '"'
-# PROP Intermediate_Dir "Debug#$ $text = "$DLL" . '"'
+# PROP Output_Dir "Debug#$ $text = "$UNICODE$DLL" . '"'
+# PROP Intermediate_Dir "Debug#$ $text = "$UNICODE$DLL" . '"'
#$ Config("windows") && ($text='# PROP Ignore_Export_Lib 0');
# PROP Target_Dir ""
# ADD BASE CPP #$ Expand("VC_BASE_CPP_DEBUG");
#include "wx/wxchar.h"
// ----------------------------------------------------------------------------
-/**
- @name Debugging macros
-
- All debugging macros rely on ASSERT() which in turn calls user-defined
- OnAssert() function. To keep things simple, it's called even when the
- expression is TRUE (i.e. everything is ok) and by default does nothing: just
- returns the same value back. But if you redefine it to do something more sexy
- (popping up a message box in your favourite GUI, sending you e-mail or
- whatever) it will affect all ASSERTs, FAILs and CHECKs in your code.
- <BR>
- <BR>
- <b>Warning</b>: if you don't like advices on programming style, don't read
- further! ;-)
- <BR>
- <BR>
- Extensive use of these macros is recommended! Remember that ASSERTs are
- disabled in final (without __WXDEBUG__ defined) build, so they add strictly
- nothing to your program's code. On the other hand, CHECK macros do stay
- even in release builds, but in general are not much of a burden, while
- a judicious use of them might increase your program's stability.
-
- @memo Debugging macros (replacement for standard assert()) and more.
- */
+// Debugging macros
+//
+// All debugging macros rely on ASSERT() which in turn calls user-defined
+// OnAssert() function. To keep things simple, it's called even when the
+// expression is TRUE (i.e. everything is ok) and by default does nothing: just
+// returns the same value back. But if you redefine it to do something more sexy
+// (popping up a message box in your favourite GUI, sending you e-mail or
+// whatever) it will affect all ASSERTs, FAILs and CHECKs in your code.
+//
+// Warning: if you don't like advices on programming style, don't read
+// further! ;-)
+//
+// Extensive use of these macros is recommended! Remember that ASSERTs are
+// disabled in final (without __WXDEBUG__ defined) build, so they add strictly
+// nothing to your program's code. On the other hand, CHECK macros do stay
+// even in release builds, but in general are not much of a burden, while
+// a judicious use of them might increase your program's stability.
// ----------------------------------------------------------------------------
-//@{
// Use of these suppresses compiler warnings about testing constant expression
WXDLLEXPORT_DATA(extern const bool) wxTrue;
WXDLLEXPORT_DATA(extern const bool) wxFalse;
-/** @name Macros which are completely disabled in 'release' mode */
-//@{
+// Macros which are completely disabled in 'release' mode
#ifdef __WXDEBUG__
- /**
- this function may be redefined to do something non trivial and is called
- whenever one of debugging macros fails (i.e. condition is false in an
- assertion)
- @param szFile and nLine - file name and line number of the ASSERT
- szMsg - optional message explaining the reason
+ /*
+ this function may be redefined to do something non trivial and is called
+ whenever one of debugging macros fails (i.e. condition is false in an
+ assertion)
+
+ parameters:
+ szFile and nLine - file name and line number of the ASSERT
+ szMsg - optional message explaining the reason
*/
void WXDLLEXPORT wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg = (const wxChar *) NULL);
- /// generic assert macro
- #define wxASSERT(cond) if ( !(cond) ) wxOnAssert(__TFILE__, __LINE__)
+ /*
+ notice the usage of else at the end of wxASSERT macro: this ensures that
+ the following code
+
+ if ( ... )
+ wxASSERT(...);
+ else
+ ...
+
+ works like expected: if there were no "else", the one in the code above
+ would be matched with a wrong "if"
+ */
+
+ // generic assert macro
+ #define wxASSERT(cond) if ( !(cond) ) wxOnAssert(__TFILE__, __LINE__); else
- /// assert with additional message explaining it's cause
- #define wxASSERT_MSG(x, m) if ( !(x) ) wxOnAssert(__TFILE__, __LINE__, m)
+ // assert with additional message explaining it's cause
+ #define wxASSERT_MSG(cond, msg) \
+ if ( !(cond) ) wxOnAssert(__TFILE__, __LINE__, msg); else
#else
// nothing to do in release modes (hopefully at this moment there are
// no more bugs ;-)
- #define wxASSERT(cond)
- #define wxASSERT_MSG(x, m)
+ #define wxASSERT(cond)
+ #define wxASSERT_MSG(x, m)
#endif //__WXDEBUG__
-/// special form of assert: always triggers it (in debug mode)
-#define wxFAIL wxASSERT(wxFalse)
+// special form of assert: always triggers it (in debug mode)
+#define wxFAIL wxASSERT(wxFalse)
-/// FAIL with some message
-#define wxFAIL_MSG(msg) wxASSERT_MSG(wxFalse, msg)
-//@}
+// FAIL with some message
+#define wxFAIL_MSG(msg) wxASSERT_MSG(wxFalse, msg)
-// NB: these macros work also in release mode!
+// NB: the following macros work also in release mode!
-/**
+/*
These macros must be used only in invalid situation: for example, an
invalid parameter (NULL pointer) is passed to a function. Instead of
dereferencing it and causing core dump the function might try using
CHECK( p != NULL ) or CHECK( p != NULL, return LogError("p is NULL!!") )
-
- @name Macros which remain even in 'release' mode
*/
-//@{
- /// check that expression is true, "return" if not (also FAILs in debug mode)
-#define wxCHECK(x, rc) if (!(x)) {wxFAIL; return rc; }
- /// as wxCHECK but with a message explaining why we fail
-#define wxCHECK_MSG(x, rc, msg) if (!(x)) {wxFAIL_MSG(msg); return rc; }
- /// check that expression is true, perform op if not
-#define wxCHECK2(x, op) if (!(x)) {wxFAIL; op; }
- /// as wxCHECK2 but with a message explaining why we fail
-#define wxCHECK2_MSG(x, op, msg) if (!(x)) {wxFAIL_MSG(msg); op; }
- /// special form of wxCHECK2: as wxCHECK, but for use in void functions
- // NB: there is only one form (with msg parameter) and it's intentional:
- // there is no other way to tell the caller what exactly went wrong
- // from the void function (of course, the function shouldn't be void
- // to begin with...)
-#define wxCHECK_RET(x, msg) if (!(x)) {wxFAIL_MSG(msg); return; }
-//@}
-
-//@}
+
+// check that expression is true, "return" if not (also FAILs in debug mode)
+#define wxCHECK(x, rc) if (!(x)) {wxFAIL; return rc; }
+
+// as wxCHECK but with a message explaining why we fail
+#define wxCHECK_MSG(x, rc, msg) if (!(x)) {wxFAIL_MSG(msg); return rc; }
+
+// check that expression is true, perform op if not
+#define wxCHECK2(x, op) if (!(x)) {wxFAIL; op; }
+
+// as wxCHECK2 but with a message explaining why we fail
+#define wxCHECK2_MSG(x, op, msg) if (!(x)) {wxFAIL_MSG(msg); op; }
+
+// special form of wxCHECK2: as wxCHECK, but for use in void functions
+// NB: there is only one form (with msg parameter) and it's intentional:
+// there is no other way to tell the caller what exactly went wrong
+// from the void function (of course, the function shouldn't be void
+// to begin with...)
+#define wxCHECK_RET(x, msg) if (!(x)) {wxFAIL_MSG(msg); return; }
#endif // _WX_DEBUG_H_
+
#endif
#if defined(__APPLE__)
- // MacOS X
+ // MacOS X
#ifndef __WXMAC__
#define __WXMAC__
#endif
#ifndef __WXMAC_X__
#define __WXMAC_X__
#endif
-
+
#define PM_USE_SESSION_APIS 0
#include <Carbon/Carbon.h>
#endif
-#elif defined(applec) || defined(THINK_C) || (defined(__MWERKS__) && !defined(__INTEL__))
- // MacOS
+#elif defined(applec) || \
+ defined(THINK_C) || \
+ (defined(__MWERKS__) && !defined(__INTEL__))
+ // MacOS
#elif defined(__WXMAC__) && defined(__APPLE__)
- // MacOS X
+ // MacOS X
#define __UNIX_LIKE__
#ifndef __WXMAC__
#ifndef __WXMAC_X__
#define __WXMAC_X__
#endif
-
+
#define PM_USE_SESSION_APIS 0
#include <Carbon/Carbon.h>
#elif defined(__OS2__)
// our HDC and its usage count: we only free it when the usage count drops
// to 0
WXHDC m_hDC;
- int m_hDCCount;
// Store all old GDI objects when do a SelectObject, so we can select them
// back in (this unselecting user's objects) so we can safely delete the
class WXDLLEXPORT wxWindowDC : public wxDC
{
- DECLARE_DYNAMIC_CLASS(wxWindowDC)
-
public:
+ // default ctor
wxWindowDC();
// Create a DC corresponding to the whole window
wxWindowDC(wxWindow *win);
- virtual ~wxWindowDC();
+protected:
+ // intiialize the newly created DC
+ void InitDC();
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxWindowDC)
};
class WXDLLEXPORT wxClientDC : public wxWindowDC
{
- DECLARE_DYNAMIC_CLASS(wxClientDC)
-
public:
+ // default ctor
wxClientDC();
// Create a DC corresponding to the client area of the window
wxClientDC(wxWindow *win);
- virtual ~wxClientDC();
+private:
+ DECLARE_DYNAMIC_CLASS(wxClientDC)
};
class WXDLLEXPORT wxPaintDC : public wxWindowDC
{
- DECLARE_DYNAMIC_CLASS(wxPaintDC)
-
public:
wxPaintDC();
// find the entry for this DC in the cache (keyed by the window)
wxPaintDCInfo *FindInCache(size_t *index = NULL) const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPaintDC)
};
#endif
/////////////////////////////////////////////////////////////////////////////
-// Name: dcmemory.h
+// Name: wx/msw/dcmemory.h
// Purpose: wxMemoryDC class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCMEMORY_H_
wxMemoryDC();
wxMemoryDC(wxDC *dc); // Create compatible DC
- ~wxMemoryDC();
-
- virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
virtual void SelectObject(const wxBitmap& bitmap);
+protected:
+ // override some base class virtuals
+ virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
virtual void DoGetSize(int* width, int* height) const;
+ // create DC compatible with the given one or screen if dc == NULL
+ bool CreateCompatible(wxDC *dc);
+
+ // initialize the newly created DC
+ void Init();
+
private:
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
};
#include "wx/dc.h"
#include "wx/cmndata.h"
-class WXDLLEXPORT wxPrinterDC: public wxDC
+class WXDLLEXPORT wxPrinterDC : public wxDC
{
public:
-DECLARE_CLASS(wxPrinterDC)
-
// Create a printer DC (obsolete function: use wxPrintData version now)
wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, int orientation = wxPORTRAIT);
wxPrinterDC(WXHDC theDC);
- ~wxPrinterDC(void);
-
// override some base class virtuals
virtual bool StartDoc(const wxString& message);
virtual void EndDoc();
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop = wxCOPY, bool useMask = FALSE);
+ // init the dc
+ void Init();
+
wxPrintData m_printData;
+
+private:
+ DECLARE_CLASS(wxPrinterDC)
};
// Gets an HDC for the default printer configuration
/////////////////////////////////////////////////////////////////////////////
-// Name: dcscreen.h
+// Name: wx/msw/dcscreen.h
// Purpose: wxScreenDC class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCSCREEN_H_
#include "wx/dcclient.h"
-class WXDLLEXPORT wxScreenDC: public wxWindowDC
+class WXDLLEXPORT wxScreenDC : public wxWindowDC
{
- DECLARE_DYNAMIC_CLASS(wxScreenDC)
-
- public:
- // Create a DC representing the whole screen
- wxScreenDC(void);
- ~wxScreenDC(void);
-
- // Compatibility with X's requirements for
- // drawing on top of all windows
- static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return TRUE; }
- static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return TRUE; }
- static bool EndDrawingOnTop(void) { return TRUE; }
+public:
+ // Create a DC representing the whole screen
+ wxScreenDC();
+
+ // Compatibility with X's requirements for drawing on top of all windows
+ static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return TRUE; }
+ static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return TRUE; }
+ static bool EndDrawingOnTop(void) { return TRUE; }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxScreenDC)
};
#endif
DECLARE_DYNAMIC_CLASS(wxEnhMetaFileDC)
};
+#if wxUSE_DRAG_AND_DROP
+
// ----------------------------------------------------------------------------
// wxEnhMetaFileDataObject is a specialization of wxDataObject for enh metafile
// ----------------------------------------------------------------------------
-#if wxUSE_DRAG_AND_DROP
-
// notice that we want to support both CF_METAFILEPICT and CF_ENHMETAFILE and
// so we derive from wxDataObject and not from wxDataObjectSimple
class WXDLLEXPORT wxEnhMetaFileDataObject : public wxDataObject
wxEnhMetaFile m_metafile;
};
+
+// ----------------------------------------------------------------------------
+// wxEnhMetaFileSimpleDataObject does derive from wxDataObjectSimple which
+// makes it more convenient to use (it can be used with wxDataObjectComposite)
+// at the price of not supoprting any more CF_METAFILEPICT but only
+// CF_ENHMETAFILE
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxEnhMetaFileSimpleDataObject : public wxDataObjectSimple
+{
+public:
+ // ctors
+ wxEnhMetaFileSimpleDataObject() : wxDataObjectSimple(wxDF_ENHMETAFILE) { }
+ wxEnhMetaFileSimpleDataObject(const wxEnhMetaFile& metafile)
+ : wxDataObjectSimple(wxDF_ENHMETAFILE), m_metafile(metafile) { }
+
+ // virtual functions which you may override if you want to provide data on
+ // demand only - otherwise, the trivial default versions will be used
+ virtual void SetEnhMetafile(const wxEnhMetaFile& metafile)
+ { m_metafile = metafile; }
+ virtual wxEnhMetaFile GetEnhMetafile() const
+ { return m_metafile; }
+
+ // implement base class pure virtuals
+ virtual size_t GetDataSize() const;
+ virtual bool GetDataHere(void *buf) const;
+ virtual bool SetData(size_t len, const void *buf);
+
+protected:
+ wxEnhMetaFile m_metafile;
+};
+
#endif // wxUSE_DRAG_AND_DROP
#endif // _WX_MSW_ENHMETA_H_
//#define TEST_HASH
//#define TEST_INFO_FUNCTIONS
//#define TEST_LIST
-#define TEST_LOCALE
+//#define TEST_LOCALE
//#define TEST_LOG
//#define TEST_LONGLONG
//#define TEST_MIME
//#define TEST_PATHLIST
+#define TEST_REGCONF
//#define TEST_REGISTRY
//#define TEST_SOCKETS
//#define TEST_STREAMS
#endif // TEST_PATHLIST
// ----------------------------------------------------------------------------
-// registry
+// registry and related stuff
// ----------------------------------------------------------------------------
// this is for MSW only
#ifndef __WXMSW__
+ #undef TEST_REGCONF
#undef TEST_REGISTRY
#endif
+#ifdef TEST_REGCONF
+
+#include <wx/confbase.h>
+#include <wx/msw/regconf.h>
+
+static void TestRegConfWrite()
+{
+ wxRegConfig regconf(_T("console"), _T("wxwindows"));
+ regconf.Write(_T("Hello"), wxString(_T("world")));
+}
+
+#endif // TEST_REGCONF
+
#ifdef TEST_REGISTRY
#include <wx/msw/registry.h>
TestPathList();
#endif // TEST_PATHLIST
+#ifdef TEST_REGCONF
+ TestRegConfWrite();
+#endif // TEST_REGCONF
+
#ifdef TEST_REGISTRY
if ( 0 )
TestRegistryRead();
m_gaugeVert = new wxGauge( panel, -1, 100,
wxPoint(195,35), wxSize(30, 90),
wxGA_VERTICAL | wxGA_SMOOTH | wxNO_BORDER );
- m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1), wxSL_LABELS );
+ m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1),
+ wxSL_AUTOTICKS | wxSL_LABELS );
+ m_slider->SetTickFreq(40, 0);
(void)new wxStaticBox( panel, -1, "&Explanation", wxPoint(230,10), wxSize(270,130) );
#ifdef __WXMOTIF__
// No wrapping text in wxStaticText yet :-(
+dialogs ICON "dialogs.ico"
+
#include "wx/msw/wx.rc"
m_windowExtX = VIEWPORT_EXTENT;
m_windowExtY = VIEWPORT_EXTENT;
-
- m_hDCCount = 0;
}
wxDC::~wxDC()
{
- if ( m_hDC != 0 ) {
+ if ( m_hDC != 0 )
+ {
SelectOldObjects(m_hDC);
- if ( m_bOwnsDC ) {
- if ( m_canvas == NULL )
- ::DeleteDC(GetHdc());
- else
- ::ReleaseDC((HWND)m_canvas->GetHWND(), GetHdc());
+
+ // if we own the HDC, we delete it, otherwise we just release it
+
+ if ( m_bOwnsDC )
+ {
+ ::DeleteDC(GetHdc());
}
- }
+ else // we don't own our HDC
+ {
+ // this is not supposed to happen as we can't free the HDC then
+ wxCHECK_RET( m_canvas, _T("no canvas in not owning ~wxDC?") );
+ ::ReleaseDC(GetHwndOf(m_canvas), GetHdc());
+ }
+ }
}
// This will select current objects out of the DC,
// macros
// ----------------------------------------------------------------------------
- IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
- IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
- IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
+IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
+IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
+IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
// ----------------------------------------------------------------------------
// global variables
wxWindowDC::wxWindowDC()
{
- m_canvas = NULL;
+ m_canvas = NULL;
}
-wxWindowDC::wxWindowDC(wxWindow *the_canvas)
+wxWindowDC::wxWindowDC(wxWindow *canvas)
{
- m_canvas = the_canvas;
- m_hDC = (WXHDC) ::GetWindowDC(GetWinHwnd(the_canvas) );
- m_hDCCount++;
+ wxCHECK_RET( canvas, _T("invalid window in wxWindowDC") );
- SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
-}
+ m_canvas = canvas;
+ m_hDC = (WXHDC) ::GetWindowDC(GetHwndOf(m_canvas));
-wxWindowDC::~wxWindowDC()
-{
- if (m_canvas && m_hDC)
- {
- SelectOldObjects(m_hDC);
+ // m_bOwnsDC was already set to false in the base class ctor, so the DC
+ // will be released (and not deleted) in ~wxDC
- if ( !::ReleaseDC(GetWinHwnd(m_canvas), GetHdc()) )
- {
- wxLogLastError(wxT("ReleaseDC"));
- }
+ InitDC();
+}
- m_hDC = 0;
- }
+void wxWindowDC::InitDC()
+{
+ // the background mode is only used for text background and is set in
+ // DrawText() to OPAQUE as required, otherwise always TRANSPARENT,
+ ::SetBkMode(GetHdc(), TRANSPARENT);
- m_hDCCount--;
+ // default bg colour is pne of the window
+ SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
}
// ----------------------------------------------------------------------------
wxClientDC::wxClientDC()
{
- m_canvas = NULL;
+ m_canvas = NULL;
}
-wxClientDC::wxClientDC(wxWindow *the_canvas)
+wxClientDC::wxClientDC(wxWindow *canvas)
{
- m_canvas = the_canvas;
- m_hDC = (WXHDC) ::GetDC(GetWinHwnd(the_canvas));
+ wxCHECK_RET( canvas, _T("invalid window in wxClientDC") );
- // the background mode is only used for text background
- // and is set in DrawText() to OPAQUE as required, other-
- // wise always TRANSPARENT, RR
- ::SetBkMode( GetHdc(), TRANSPARENT );
-
- SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
-}
+ m_canvas = canvas;
+ m_hDC = (WXHDC)::GetDC(GetHwndOf(m_canvas));
-wxClientDC::~wxClientDC()
-{
- if ( m_canvas && GetHdc() )
- {
- SelectOldObjects(m_hDC);
+ // m_bOwnsDC was already set to false in the base class ctor, so the DC
+ // will be released (and not deleted) in ~wxDC
- ::ReleaseDC(GetWinHwnd(m_canvas), GetHdc());
- m_hDC = 0;
- }
+ InitDC();
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// VZ: initial implementation (by JACS) only remembered the last wxPaintDC
-// created and tried to reuse - this was supposed to take care of a
+// created and tried to reuse it - this was supposed to take care of a
// situation when a derived class OnPaint() calls base class OnPaint()
// because in this case ::BeginPaint() shouldn't be called second time.
//
wxPaintDC::wxPaintDC()
{
m_canvas = NULL;
- m_hDC = 0;
}
wxPaintDC::wxPaintDC(wxWindow *canvas)
}
else // not in cache, create a new one
{
- m_hDC = (WXHDC)::BeginPaint(GetWinHwnd(m_canvas), &g_paintStruct);
+ m_hDC = (WXHDC)::BeginPaint(GetHwndOf(m_canvas), &g_paintStruct);
ms_cache.Add(new wxPaintDCInfo(m_canvas, this));
}
- // the background mode is only used for text background
- // and is set in DrawText() to OPAQUE as required, other-
- // wise always TRANSPARENT, RR
- ::SetBkMode( GetHdc(), TRANSPARENT );
-
- SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
+ InitDC();
}
wxPaintDC::~wxPaintDC()
if ( !--info->count )
{
- ::EndPaint(GetWinHwnd(m_canvas), &g_paintStruct);
+ ::EndPaint(GetHwndOf(m_canvas), &g_paintStruct);
ms_cache.Remove(index);
wxMemoryDC::wxMemoryDC()
{
- m_hDC = (WXHDC) ::CreateCompatibleDC((HDC) NULL);
- m_ok = (m_hDC != 0);
- m_bOwnsDC = TRUE;
-
- SetBrush(*wxWHITE_BRUSH);
- SetPen(*wxBLACK_PEN);
+ CreateCompatible(NULL);
- // the background mode is only used for text background and is set in
- // DrawText() to OPAQUE as required, otherwise always TRANSPARENT
- ::SetBkMode( GetHdc(), TRANSPARENT );
+ Init();
}
-wxMemoryDC::wxMemoryDC(wxDC *old_dc)
+wxMemoryDC::wxMemoryDC(wxDC *dc)
{
- old_dc->BeginDrawing();
+ wxCHECK_RET( dc, _T("NULL dc in wxMemoryDC ctor") );
+
+ dc->BeginDrawing();
- m_hDC = (WXHDC) ::CreateCompatibleDC(GetHdcOf(*old_dc));
- m_ok = (m_hDC != 0);
+ CreateCompatible(dc);
- old_dc->EndDrawing();
+ dc->EndDrawing();
- SetBrush(*wxWHITE_BRUSH);
- SetPen(*wxBLACK_PEN);
+ Init();
+}
+
+void wxMemoryDC::Init()
+{
+ if ( m_ok )
+ {
+ SetBrush(*wxWHITE_BRUSH);
+ SetPen(*wxBLACK_PEN);
- // the background mode is only used for text background and is set in
- // DrawText() to OPAQUE as required, otherwise always TRANSPARENT
- ::SetBkMode( GetHdc(), TRANSPARENT );
+ // the background mode is only used for text background and is set in
+ // DrawText() to OPAQUE as required, otherwise always TRANSPARENT
+ ::SetBkMode( GetHdc(), TRANSPARENT );
+ }
}
-wxMemoryDC::~wxMemoryDC()
+bool wxMemoryDC::CreateCompatible(wxDC *dc)
{
+ m_hDC = (WXHDC)::CreateCompatibleDC(dc ? GetHdcOf(*dc) : NULL);
+
+ // as we created the DC, we must delete it in the dtor
+ m_bOwnsDC = TRUE;
+
+ m_ok = m_hDC != 0;
+
+ return m_ok;
}
void wxMemoryDC::SelectObject(const wxBitmap& bitmap)
// ----------------------------------------------------------------------------
// This form is deprecated
-wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_name, const wxString& file, bool interactive, int orientation)
+wxPrinterDC::wxPrinterDC(const wxString& driver_name,
+ const wxString& device_name,
+ const wxString& file,
+ bool interactive,
+ int orientation)
{
m_isInteractive = interactive;
- if ( !!file )
+ if ( !file.empty() )
m_printData.SetFilename(file);
#if wxUSE_COMMON_DIALOGS
- if (interactive)
+ if ( interactive )
{
PRINTDLG pd;
pd.lStructSize = sizeof( PRINTDLG );
- pd.hwndOwner=(HWND) NULL;
- pd.hDevMode=(HANDLE)NULL;
- pd.hDevNames=(HANDLE)NULL;
- pd.Flags=PD_RETURNDC | PD_NOSELECTION | PD_NOPAGENUMS;
- pd.nFromPage=0;
- pd.nToPage=0;
- pd.nMinPage=0;
- pd.nMaxPage=0;
- pd.nCopies=1;
- pd.hInstance=(HINSTANCE)NULL;
-
- if ( PrintDlg( &pd ) != 0 )
+ pd.hwndOwner = (HWND) NULL;
+ pd.hDevMode = (HANDLE)NULL;
+ pd.hDevNames = (HANDLE)NULL;
+ pd.Flags = PD_RETURNDC | PD_NOSELECTION | PD_NOPAGENUMS;
+ pd.nFromPage = 0;
+ pd.nToPage = 0;
+ pd.nMinPage = 0;
+ pd.nMaxPage = 0;
+ pd.nCopies = 1;
+ pd.hInstance = (HINSTANCE)NULL;
+
+ m_ok = PrintDlg( &pd ) != 0;
+ if ( m_ok )
{
m_hDC = (WXHDC) pd.hDC;
- m_ok = TRUE;
}
- else
- {
- m_ok = FALSE;
- return;
- }
-
- // m_dontDelete = TRUE;
}
else
#endif // wxUSE_COMMON_DIALOGS
- if ((!driver_name.IsNull() && driver_name != wxT("")) &&
- (!device_name.IsNull() && device_name != wxT("")) &&
- (!file.IsNull() && file != wxT("")))
+ {
+ if ( !driver_name.empty() && !device_name.empty() && !file.empty() )
{
- m_hDC = (WXHDC) CreateDC(WXSTRINGCAST driver_name, WXSTRINGCAST device_name, WXSTRINGCAST file, NULL);
- m_ok = m_hDC ? TRUE: FALSE;
+ m_hDC = (WXHDC) CreateDC(driver_name, device_name, file, NULL);
}
- else
+ else // we don't have all parameters, ask the user
{
wxPrintData printData;
printData.SetOrientation(orientation);
m_hDC = wxGetPrinterDC(printData);
- m_ok = m_hDC ? TRUE: FALSE;
}
- if (m_hDC)
- {
- // int width = GetDeviceCaps(m_hDC, VERTRES);
- // int height = GetDeviceCaps(m_hDC, HORZRES);
- SetMapMode(wxMM_TEXT);
- }
- SetBrush(*wxBLACK_BRUSH);
- SetPen(*wxBLACK_PEN);
+ m_ok = m_hDC ? TRUE: FALSE;
+
+ // as we created it, we must delete it as well
+ m_bOwnsDC = TRUE;
+ }
+
+ Init();
}
wxPrinterDC::wxPrinterDC(const wxPrintData& printData)
m_isInteractive = FALSE;
m_hDC = wxGetPrinterDC(printData);
- m_ok = (m_hDC != 0);
+ m_ok = m_hDC != 0;
+ m_bOwnsDC = TRUE;
- if (m_hDC)
- SetMapMode(wxMM_TEXT);
-
- SetBrush(*wxBLACK_BRUSH);
- SetPen(*wxBLACK_PEN);
+ Init();
}
-wxPrinterDC::wxPrinterDC(WXHDC theDC)
+wxPrinterDC::wxPrinterDC(WXHDC dc)
{
m_isInteractive = FALSE;
- m_hDC = theDC;
+ m_hDC = dc;
+ m_bOwnsDC = TRUE;
m_ok = TRUE;
- if (m_hDC)
+}
+
+void wxPrinterDC::Init()
+{
+ if ( m_hDC )
{
// int width = GetDeviceCaps(m_hDC, VERTRES);
// int height = GetDeviceCaps(m_hDC, HORZRES);
SetMapMode(wxMM_TEXT);
- }
- SetBrush(*wxBLACK_BRUSH);
- SetPen(*wxBLACK_PEN);
-}
-wxPrinterDC::~wxPrinterDC()
-{
+ SetBrush(*wxBLACK_BRUSH);
+ SetPen(*wxBLACK_PEN);
+ }
}
// ----------------------------------------------------------------------------
// Returns default device and port names
static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName)
{
- deviceName = "";
+ deviceName.clear();
LPDEVNAMES lpDevNames;
LPSTR lpszDriverName;
}
return (WXHDC) hDC;
}
-#endif
+#endif // 0
// Gets an HDC for the specified printer configuration
WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
/////////////////////////////////////////////////////////////////////////////
-// Name: dcscreen.cpp
+// Name: src/msw/dcscreen.cpp
// Purpose: wxScreenDC class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
// Create a DC representing the whole screen
-wxScreenDC::wxScreenDC(void)
+wxScreenDC::wxScreenDC()
{
- m_hDC = (WXHDC) ::GetDC((HWND) NULL);
- m_hDCCount ++;
+ m_hDC = (WXHDC) ::GetDC((HWND) NULL);
- // the background mode is only used for text background
- // and is set in DrawText() to OPAQUE as required, other-
- // wise always TRANSPARENT, RR
- ::SetBkMode( GetHdc(), TRANSPARENT );
-}
-
-wxScreenDC::~wxScreenDC(void)
-{
- SelectOldObjects(m_hDC);
- ::ReleaseDC((HWND) NULL, (HDC) m_hDC);
- m_hDC = 0;
- m_hDCCount --;
+ // the background mode is only used for text background and is set in
+ // DrawText() to OPAQUE as required, otherwise always TRANSPARENT
+ ::SetBkMode( GetHdc(), TRANSPARENT );
}
DEFINE_EVENT_TYPE(wxEVT_DIALUP_DISCONNECTED)
// Doesn't yet compile under VC++ 4, BC++, Watcom C++: no wininet.h
-#if !defined(__BORLANDC__) && !defined(__GNUWIN32_OLD__) && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 0, 5 ) ) && !defined(__WATCOMC__) && ! (defined(__VISUALC__) && (__VISUALC__ < 1020))
+#if !defined(__BORLANDC__) && \
+ !defined(__GNUWIN32_OLD__) && \
+ !defined(__WATCOMC__) && \
+ (!defined(__VISUALC__) || (__VISUALC__ >= 1020))
+ // FIXME: add this back as soon as wxCHECK_W32API_VERSION is chcked in
+ // (!defined(__GNUWIN32__) || wxCHECK_W32API_VERSION(0, 5)) && \
#include <ras.h>
#include <raserror.h>
m_hDC = 0;
}
+#if wxUSE_DRAG_AND_DROP
+
// ----------------------------------------------------------------------------
// wxEnhMetaFileDataObject
// ----------------------------------------------------------------------------
-#if wxUSE_DRAG_AND_DROP
-
wxDataFormat
wxEnhMetaFileDataObject::GetPreferredFormat(Direction WXUNUSED(dir)) const
{
return TRUE;
}
+
+// ----------------------------------------------------------------------------
+// wxEnhMetaFileSimpleDataObject
+// ----------------------------------------------------------------------------
+
+size_t wxEnhMetaFileSimpleDataObject::GetDataSize() const
+{
+ // we pass data by handle and not HGLOBAL
+ return 0u;
+}
+
+bool wxEnhMetaFileSimpleDataObject::GetDataHere(void *buf) const
+{
+ wxCHECK_MSG( m_metafile.Ok(), FALSE, _T("copying invalid enh metafile") );
+
+ HENHMETAFILE hEMF = (HENHMETAFILE)m_metafile.GetHENHMETAFILE();
+
+ HENHMETAFILE hEMFCopy = ::CopyEnhMetaFile(hEMF, NULL);
+ if ( !hEMFCopy )
+ {
+ wxLogLastError(_T("CopyEnhMetaFile"));
+
+ return FALSE;
+ }
+
+ *(HENHMETAFILE *)buf = hEMFCopy;
+ return TRUE;
+}
+
+bool wxEnhMetaFileSimpleDataObject::SetData(size_t WXUNUSED(len),
+ const void *buf)
+{
+ HENHMETAFILE hEMF = *(HENHMETAFILE *)buf;
+
+ wxCHECK_MSG( hEMF, FALSE, _T("pasting invalid enh metafile") );
+ m_metafile.SetHENHMETAFILE((WXHANDLE)hEMF);
+
+ return TRUE;
+}
+
#endif // wxUSE_DRAG_AND_DROP
#endif // wxUSE_ENH_METAFILE
# End Source File
# Begin Source File
+SOURCE=.\src\msw\dummy.cpp
+# ADD CPP /Yc"wx/wxprec.h"
+# End Source File
+# Begin Source File
+
SOURCE=.\src\common\dynarray.cpp
# End Source File
# Begin Source File