*** empty log message ***

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster 1999-09-21 05:16:03 +00:00
parent 0ba1a6f33c
commit 23e4b7d824
5 changed files with 952 additions and 740 deletions

View File

@ -1,139 +1,84 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcclient.h
// Purpose: wxClientDC, wxPaintDC and wxWindowDC classes
// Author: AUTHOR
// Purpose: wxClientDC class
// Author: Julian Smart
// Modified by:
// Created: ??/??/98
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
// Licence: wxWindows licence
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCCLIENT_H_
#define _WX_DCCLIENT_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma interface "dcclient.h"
#pragma interface "dcclient.h"
#endif
#include "wx/dc.h"
#include "wx/dynarray.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// array types
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxPaintDC;
class WXDLLEXPORT wxWindow;
// this one if used by wxPaintDC only
struct WXDLLEXPORT wxPaintDCInfo;
// Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented differently.
// On many platforms, however, they will be the same.
WX_DECLARE_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo);
class WXDLLEXPORT wxWindowDC: public wxDC
// ----------------------------------------------------------------------------
// DC classes
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxWindowDC : public wxDC
{
DECLARE_DYNAMIC_CLASS(wxWindowDC)
DECLARE_DYNAMIC_CLASS(wxWindowDC)
public:
public:
wxWindowDC();
wxWindowDC(void);
wxWindowDC( wxWindow *win );
// Create a DC corresponding to the whole window
wxWindowDC(wxWindow *win);
~wxWindowDC(void);
virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE );
virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
virtual void DrawLine( long x1, long y1, long x2, long y2 );
virtual void CrossHair( long x, long y );
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc );
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
virtual void DrawPoint( long x, long y );
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 );
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE );
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE );
virtual void DrawRectangle( long x, long y, long width, long height );
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
virtual void DrawEllipse( long x, long y, long width, long height );
virtual bool CanDrawBitmap(void) const;
virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE );
virtual bool Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
virtual bool CanGetTextExtent(void) const;
virtual void GetTextExtent( const wxString &string, long *width, long *height,
long *descent = NULL, long *externalLeading = NULL,
wxFont *theFont = NULL, bool use16 = FALSE ) const;
virtual long GetCharWidth(void) const;
virtual long GetCharHeight(void) const;
virtual void Clear(void);
virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen );
virtual void SetBrush( const wxBrush &brush );
virtual void SetBackground( const wxBrush &brush );
virtual void SetLogicalFunction( int function );
virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col );
virtual void SetBackgroundMode( int mode );
virtual void SetPalette( const wxPalette& palette );
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void SetClippingRegion( const wxRegion& region ) ;
virtual void DestroyClippingRegion(void);
virtual void DrawSpline( wxList *points );
private:
// to supress virtual function hiding, do not use
void DrawEllipticArc(const wxPoint& pt, const wxSize& sz,
double sa, double ea)
{ wxDC::DrawEllipticArc(pt, sz, sa, ea); };
void DrawPoint(wxPoint& pt)
{ wxDC:DrawPoint(pt); };
void DrawSpline(int n, wxPoint points[])
{ wxDC::DrawSpline(n, points); };
void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3)
{ wxDC::DrawSpline(x1, y1, x2, y2, x3, y3); };
virtual void GetTextExtent( const wxString &string, long *width, long *height,
long *descent = NULL, long *externalLeading = NULL,
wxFont *theFont = NULL) const
{ GetTextExtent(string, width, height, descent, externalLeading, theFont, FALSE); };
virtual ~wxWindowDC();
};
//-----------------------------------------------------------------------------
// wxPaintDC
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPaintDC: public wxWindowDC
class WXDLLEXPORT wxClientDC : public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxPaintDC)
DECLARE_DYNAMIC_CLASS(wxClientDC)
public:
public:
wxClientDC();
wxPaintDC(void):wxWindowDC() {};
wxPaintDC( wxWindow *win ): wxWindowDC(win) {};
// Create a DC corresponding to the client area of the window
wxClientDC(wxWindow *win);
virtual ~wxClientDC();
};
//-----------------------------------------------------------------------------
// wxClientDC
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxClientDC: public wxWindowDC
class WXDLLEXPORT wxPaintDC : public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxClientDC)
DECLARE_DYNAMIC_CLASS(wxPaintDC)
public:
public:
wxPaintDC();
wxClientDC(void):wxWindowDC() {};
wxClientDC( wxWindow *win ): wxWindowDC(win) {};
// Create a DC corresponding for painting the window in OnPaint()
wxPaintDC(wxWindow *win);
virtual ~wxPaintDC();
protected:
static wxArrayDCInfo ms_cache;
// find the entry for this DC in the cache (keyed by the window)
wxPaintDCInfo *FindInCache(size_t *index = NULL) const;
};
#endif

View File

@ -17,7 +17,7 @@ OS2LIBFLAGS=/NOL /NOE
OS2LIBS=CPPOM30.lib CPPOOC3.LIB OS2386.LIB
# Change this to your WXWIN directory
WXDIR=h:\dev\Wx2\wxwindows
WXDIR=j:\dev\Wx2\wxwindows
WXSRC=$(WXDIR)\src\os2
WXINC=$(WXDIR)\include

View File

@ -1,34 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: data.cpp
// Purpose: Various data
// Author: AUTHOR
// Author: David Webster
// Modified by:
// Created: ??/??/98
// Created: 09/20/99
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
// Licence: wxWindows licence
// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation
#pragma implementation "data.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#if wxUSE_POSTSCRIPT
#include "wx/dcps.h"
#endif
#include "wx/prntbase.h"
#define _MAXPATHLEN 500
// Useful buffer, initialized in CommonInit
char *wxBuffer = NULL;
// Useful buffer, initialized in wxCommonInit
wxChar *wxBuffer = NULL;
// Windows List
wxList wxTopLevelWindows;
wxWindowList wxTopLevelWindows;
// List of windows pending deletion
wxList wxPendingDelete;
wxList WXDLLEXPORT wxPendingDelete;
// List of events pending processing
#if wxUSE_THREADS
wxList *wxPendingEvents = NULL;
wxCriticalSection *wxPendingEventsLocker = NULL;
#endif
// Current cursor, in order to hang on to
// cursor handle when setting the cursor globally
wxCursor *g_globalCursor = NULL;
// Message Strings for Internationalization
char **wx_msg_str = (char**)NULL;
// Custom OS version, as optionally placed in wx.ini/.wxrc
// Currently this can be Win95, Windows, Win32s, WinNT.
// For some systems, you can't tell until run-time what services you
// have. See wxGetOsVersion, which uses this string if present.
char *wxOsVersion = NULL;
int wxPageNumber;
@ -92,56 +114,673 @@ wxFont wxNullFont;
wxColour wxNullColour;
// Default window names
const char *wxButtonNameStr = "button";
const char *wxCanvasNameStr = "canvas";
const char *wxCheckBoxNameStr = "check";
const char *wxChoiceNameStr = "choice";
const char *wxComboBoxNameStr = "comboBox";
const char *wxDialogNameStr = "dialog";
const char *wxFrameNameStr = "frame";
const char *wxGaugeNameStr = "gauge";
const char *wxStaticBoxNameStr = "groupBox";
const char *wxListBoxNameStr = "listBox";
const char *wxStaticTextNameStr = "message";
const char *wxStaticBitmapNameStr = "message";
const char *wxMultiTextNameStr = "multitext";
const char *wxPanelNameStr = "panel";
const char *wxRadioBoxNameStr = "radioBox";
const char *wxRadioButtonNameStr = "radioButton";
const char *wxBitmapRadioButtonNameStr = "radioButton";
const char *wxScrollBarNameStr = "scrollBar";
const char *wxSliderNameStr = "slider";
const char *wxStaticNameStr = "static";
const char *wxTextCtrlWindowNameStr = "textWindow";
const char *wxTextCtrlNameStr = "text";
const char *wxVirtListBoxNameStr = "virtListBox";
const char *wxButtonBarNameStr = "buttonbar";
const char *wxEnhDialogNameStr = "Shell";
const char *wxToolBarNameStr = "toolbar";
const char *wxStatusLineNameStr = "status_line";
const char *wxEmptyString = "";
const char *wxGetTextFromUserPromptStr = "Input Text";
const char *wxMessageBoxCaptionStr = "Message";
const char *wxFileSelectorPromptStr = "Select a file";
const char *wxFileSelectorDefaultWildcardStr = "*.*";
const char *wxInternalErrorStr = "wxWindows Internal Error";
const char *wxFatalErrorStr = "wxWindows Fatal Error";
const wxChar *wxButtonNameStr = _T("button");
const wxChar *wxCanvasNameStr = _T("canvas");
const wxChar *wxCheckBoxNameStr = _T("check");
const wxChar *wxChoiceNameStr = _T("choice");
const wxChar *wxComboBoxNameStr = _T("comboBox");
const wxChar *wxDialogNameStr = _T("dialog");
const wxChar *wxFrameNameStr = _T("frame");
const wxChar *wxGaugeNameStr = _T("gauge");
const wxChar *wxStaticBoxNameStr = _T("groupBox");
const wxChar *wxListBoxNameStr = _T("listBox");
const wxChar *wxStaticTextNameStr = _T("message");
const wxChar *wxStaticBitmapNameStr = _T("message");
const wxChar *wxMultiTextNameStr = _T("multitext");
const wxChar *wxPanelNameStr = _T("panel");
const wxChar *wxRadioBoxNameStr = _T("radioBox");
const wxChar *wxRadioButtonNameStr = _T("radioButton");
const wxChar *wxBitmapRadioButtonNameStr = _T("radioButton");
const wxChar *wxScrollBarNameStr = _T("scrollBar");
const wxChar *wxSliderNameStr = _T("slider");
const wxChar *wxStaticNameStr = _T("static");
const wxChar *wxTextCtrlWindowNameStr = _T("textWindow");
const wxChar *wxTextCtrlNameStr = _T("text");
const wxChar *wxVirtListBoxNameStr = _T("virtListBox");
const wxChar *wxButtonBarNameStr = _T("buttonbar");
const wxChar *wxEnhDialogNameStr = _T("Shell");
const wxChar *wxToolBarNameStr = _T("toolbar");
const wxChar *wxStatusLineNameStr = _T("status_line");
const wxChar *wxEmptyString = _T("");
const wxChar *wxGetTextFromUserPromptStr = _T("Input Text");
const wxChar *wxMessageBoxCaptionStr = _T("Message");
const wxChar *wxFileSelectorPromptStr = _T("Select a file");
const wxChar *wxFileSelectorDefaultWildcardStr = _T("*.*");
const wxChar *wxInternalErrorStr = _T("wxWindows Internal Error");
const wxChar *wxFatalErrorStr = _T("wxWindows Fatal Error");
const wxChar *wxTreeCtrlNameStr = _T("treeCtrl");
const wxChar *wxDirDialogNameStr = _T("wxDirCtrl");
const wxChar *wxDirDialogDefaultFolderStr = _T("/");
// See wx/utils.h
const char *wxFloatToStringStr = "%.2f";
const char *wxDoubleToStringStr = "%.2f";
const wxChar *wxFloatToStringStr = _T("%.2f");
const wxChar *wxDoubleToStringStr = _T("%.2f");
#ifdef __WXMSW__
const wxChar *wxUserResourceStr = _T("TEXT");
#endif
#if wxUSE_SHARED_LIBRARY
/*
* For wxWindows to be made into a dynamic library (e.g. Sun),
* all IMPLEMENT_... macros must be in one place.
* But normally, the definitions are in the appropriate places.
*/
// Hand-coded IMPLEMENT... macro for wxObject (define static data)
wxClassInfo wxObject::classwxObject("wxObject", NULL, NULL, sizeof(wxObject), NULL);
wxClassInfo *wxClassInfo::first = NULL;
wxClassInfo wxClassInfo::classTable(wxKEY_STRING);
#include "wx/button.h"
#include "wx/bmpbuttn.h"
IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
#include "wx/checkbox.h"
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
#include "wx/choice.h"
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
#if wxUSE_CLIPBOARD
#include "wx/clipbrd.h"
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject)
#endif
#if wxUSE_COMBOBOX
#include "wx/combobox.h"
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
#endif
#include "wx/dc.h"
#include "wx/dcmemory.h"
#include "wx/dcclient.h"
#include "wx/dcscreen.h"
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
#if defined(__WXMSW__)
#include "wx/dcprint.h"
IMPLEMENT_CLASS(wxPrinterDC, wxDC)
#endif
#include "wx/dialog.h"
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxWindow)
#include "wx/frame.h"
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
#include "wx/mdi.h"
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
#include "wx/cmndata.h"
IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
#include "wx/colordlg.h"
#include "wx/fontdlg.h"
#if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW
#include "wx/generic/colordlg.h"
#include "wx/generic/fontdlg.h"
IMPLEMENT_DYNAMIC_CLASS(wxGenericColourDialog, wxDialog)
IMPLEMENT_DYNAMIC_CLASS(wxGenericFontDialog, wxDialog)
#endif
// X defines wxColourDialog to be wxGenericColourDialog
#ifndef __X__
IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
#endif
#include "wx/gdicmn.h"
#include "wx/pen.h"
#include "wx/brush.h"
#include "wx/font.h"
#include "wx/palette.h"
#include "wx/icon.h"
#include "wx/cursor.h"
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
IMPLEMENT_CLASS(wxColourDatabase, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
/*
#if (!USE_TYPEDEFS)
IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxRealPoint, wxObject)
#endif
*/
#include "wx/hash.h"
IMPLEMENT_DYNAMIC_CLASS(wxHashTable, wxObject)
#include "wx/helpbase.h"
IMPLEMENT_CLASS(wxHelpControllerBase, wxObject)
#if wxUSE_HELP
#ifdef __WXMSW__
#include "wx/msw/helpwin.h"
IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase)
#endif
// Generic wxHelp controller
IMPLEMENT_CLASS(wxXLPHelpController, wxHelpControllerBase)
#ifdef __WXMSW__
IMPLEMENT_CLASS(wxXLPHelpClient, wxDDEClient)
IMPLEMENT_CLASS(wxXLPHelpConnection, wxDDEConnection)
#else
IMPLEMENT_CLASS(wxXLPHelpClient, wxTCPClient)
IMPLEMENT_CLASS(wxXLPHelpConnection, wxTCPConnection)
#endif
#endif
IMPLEMENT_DYNAMIC_CLASS(wxString, wxObject)
#include "wx/list.h"
IMPLEMENT_DYNAMIC_CLASS(wxNode, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxList, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxStringList, wxList)
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/print.h"
IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
IMPLEMENT_DYNAMIC_CLASS(wxPrinterBase, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
IMPLEMENT_DYNAMIC_CLASS(wxWindowsPrinter, wxPrinterBase)
IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject)
IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow)
IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow)
IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject)
IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
IMPLEMENT_CLASS(wxWindowsPrintPreview, wxPrintPreviewBase)
IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
#endif
#if wxUSE_POSTSCRIPT
#include "wx/dcps.h"
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPageSetupData, wxObject)
#endif
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
#if wxUSE_WX_RESOURCES
#include "wx/resource.h"
IMPLEMENT_DYNAMIC_CLASS(wxItemResource, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable)
#endif
#include "wx/event.h"
IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxShowEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMaximizeEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxIconizeEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent)
#include "wx/utils.h"
IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxList)
// IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
#include "wx/process.h"
IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler)
#if wxUSE_TIMEDATE
#include "wx/date.h"
IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject)
#endif
#if wxUSE_DOC_VIEW_ARCHITECTURE
#include "wx/docview.h"
//IMPLEMENT_ABSTRACT_CLASS(wxDocItem, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler)
IMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler)
IMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler)
IMPLEMENT_CLASS(wxDocChildFrame, wxFrame)
IMPLEMENT_CLASS(wxDocParentFrame, wxFrame)
#if wxUSE_PRINTING_ARCHITECTURE
IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout)
#endif
IMPLEMENT_CLASS(wxCommand, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxCommandProcessor, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject)
#endif
#if wxUSE_CONSTRAINTS
#include "wx/layout.h"
IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxSizer, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxRowColSizer, wxSizer)
#endif
#if wxUSE_TOOLBAR
#include "wx/tbarbase.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxToolBarBase, wxControl)
#include "wx/tbarsmpl.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBarSimple, wxToolBarBase)
#ifdef __WXMSW__
#include "wx/tbarmsw.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBarMSW, wxToolBarBase)
#include "wx/tbar95.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
#endif
#endif
#if wxUSE_SOCKETS
#include "wx/sckaddr.h"
IMPLEMENT_DYNAMIC_CLASS(wxIPV4address, wxSockAddress)
#ifdef ENABLE_IPV6
IMPLEMENT_DYNAMIC_CLASS(wxIPV6address, wxSockAddress)
#endif
#ifndef __UNIX__
IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress)
#endif
#include "wx/socket.h"
IMPLEMENT_CLASS(wxSocketBase, wxEvtHandler)
IMPLEMENT_CLASS(wxSocketClient, wxSocketBase)
IMPLEMENT_CLASS(wxSocketServer, wxSocketBase)
IMPLEMENT_CLASS(wxSocketHandler, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent)
#include "wx/url.h"
IMPLEMENT_CLASS(wxProtoInfo, wxObject)
IMPLEMENT_CLASS(wxURL, wxObject)
#include "wx/protocol/http.h"
IMPLEMENT_DYNAMIC_CLASS(wxHTTP, wxProtocol)
IMPLEMENT_PROTOCOL(wxHTTP, "http", "80", TRUE)
#include "wx/protocol/ftp.h"
IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol)
IMPLEMENT_PROTOCOL(wxFTP, "ftp", "21", TRUE)
#include "wx/protocol/sckfile.h"
IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol)
IMPLEMENT_PROTOCOL(wxFileProto, "file", NULL, FALSE)
#include "wx/sckipc.h"
IMPLEMENT_DYNAMIC_CLASS(wxTCPServer, wxServerBase)
IMPLEMENT_DYNAMIC_CLASS(wxTCPClient, wxClientBase)
IMPLEMENT_DYNAMIC_CLASS(wxTCPConnection, wxConnectionBase)
#endif
#include "wx/statusbr.h"
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
BEGIN_EVENT_TABLE(wxStatusBar, wxWindow)
EVT_PAINT(wxStatusBar::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged)
END_EVENT_TABLE()
#if wxUSE_TIMEDATE
#include "wx/time.h"
IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject)
#endif
#if !USE_GNU_WXSTRING
#include "wx/string.h"
IMPLEMENT_DYNAMIC_CLASS(wxString, wxObject)
#endif
#ifdef __WXMOTIF__
IMPLEMENT_DYNAMIC_CLASS(wxXColormap, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxXFont, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxXCursor, wxObject)
#endif
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
// This will presumably be implemented on other platforms too
#ifdef __WXMSW__
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxICOFileHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxBitmapHandler)
#endif
#include "wx/statbox.h"
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
#if wxUSE_IPC
#include "wx/dde.h"
IMPLEMENT_CLASS(wxServerBase, wxObject)
IMPLEMENT_CLASS(wxClientBase, wxObject)
IMPLEMENT_CLASS(wxConnectionBase, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxDDEServer, wxServerBase)
IMPLEMENT_DYNAMIC_CLASS(wxDDEClient, wxClientBase)
IMPLEMENT_CLASS(wxDDEConnection, wxConnectionBase)
#endif
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
#include "wx/listbox.h"
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
#include "wx/checklst.h"
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
#include "wx/menu.h"
IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
#include "wx/stattext.h"
#include "wx/statbmp.h"
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
#if wxUSE_METAFILE
#include "wx/metafile.h"
IMPLEMENT_DYNAMIC_CLASS(wxMetaFile, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxMetaFileDC, wxDC)
#endif
#include "wx/radiobox.h"
#include "wx/radiobut.h"
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
// IMPLEMENT_DYNAMIC_CLASS(wxBitmapRadioButton, wxRadioButton)
#include "wx/scrolbar.h"
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
#if WXWIN_COMPATIBILITY
BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
EVT_SCROLL(wxScrollBar::OnScroll)
END_EVENT_TABLE()
#endif
#include "wx/slider.h"
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
#if WXWIN_COMPATIBILITY
BEGIN_EVENT_TABLE(wxSlider, wxControl)
EVT_SCROLL(wxSlider::OnScroll)
END_EVENT_TABLE()
#endif
#include "wx/timer.h"
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
#include "wx/textctrl.h"
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
#include "wx/window.h"
IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler)
#include "wx/scrolwin.h"
IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxWindow)
#include "wx/panel.h"
IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow)
#include "wx/msgbxdlg.h"
#include "wx/textdlg.h"
#include "wx/filedlg.h"
#include "wx/dirdlg.h"
#include "wx/choicdlg.h"
#if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW
#include "wx/generic/msgdlgg.h"
IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog)
#endif
IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog)
IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog)
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
IMPLEMENT_CLASS(wxDirDialog, wxDialog)
#ifdef __WXMSW__
IMPLEMENT_CLASS(wxMessageDialog)
#endif
#if wxUSE_GAUGE
#ifdef __WXMOTIF__
#include "../../contrib/xmgauge/gauge.h"
#endif
#include "wx_gauge.h"
IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
#endif
#include "wx/grid.h"
IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel)
///// Event tables (also must be in one, statically-linked file for shared libraries)
// This is the base, wxEvtHandler 'bootstrap' code which is expanded manually here
const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
const wxEventTable wxEvtHandler::sm_eventTable =
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] };
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] };
const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_ACTIVATE(wxFrame::OnActivate)
EVT_SIZE(wxFrame::OnSize)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
EVT_IDLE(wxFrame::OnIdle)
EVT_CLOSE(wxFrame::OnCloseWindow)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxDialog, wxPanel)
EVT_BUTTON(wxID_OK, wxDialog::OnOK)
EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
EVT_CHAR_HOOK(wxDialog::OnCharHook)
EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
EVT_CLOSE(wxDialog::OnCloseWindow)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
EVT_CHAR(wxWindow::OnChar)
EVT_SIZE(wxWindow::Size)
EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
EVT_INIT_DIALOG(wxWindow::OnInitDialog)
EVT_IDLE(wxWindow::OnIdle)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxScrolledWindow, wxWindow)
EVT_SCROLL(wxScrolledWindow::OnScroll)
EVT_SIZE(wxScrolledWindow::OnSize)
EVT_PAINT(wxScrolledWindow::OnPaint)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPanel, wxWindow)
EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
END_EVENT_TABLE()
#ifdef __WXMSW__
BEGIN_EVENT_TABLE(wxMDIParentWindow, wxFrame)
EVT_SIZE(wxMDIParentWindow::OnSize)
EVT_ACTIVATE(wxMDIParentWindow::OnActivate)
EVT_SYS_COLOUR_CHANGED(wxMDIParentWindow::OnSysColourChanged)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
EVT_SCROLL(wxMDIClientWindow::OnScroll)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
EVT_SCROLL(wxToolBarBase::OnScroll)
EVT_SIZE(wxToolBarBase::OnSize)
EVT_IDLE(wxToolBarBase::OnIdle)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase)
EVT_SIZE(wxToolBarSimple::OnSize)
EVT_PAINT(wxToolBarSimple::OnPaint)
EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent)
END_EVENT_TABLE()
#ifdef __WXMSW__
BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase)
EVT_SIZE(wxToolBarMSW::OnSize)
EVT_PAINT(wxToolBarMSW::OnPaint)
EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
EVT_SIZE(wxToolBar95::OnSize)
EVT_PAINT(wxToolBar95::OnPaint)
EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
EVT_SIZE(wxGenericGrid::OnSize)
EVT_PAINT(wxGenericGrid::OnPaint)
EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxControl, wxWindow)
EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground)
END_EVENT_TABLE()
#if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW
BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog)
EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
EVT_PAINT(wxGenericColourDialog::OnPaint)
EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog)
EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
EVT_PAINT(wxGenericFontDialog::OnPaint)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
END_EVENT_TABLE()
#include "wx/prntbase.h"
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow)
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
END_EVENT_TABLE()
#endif
const wxSize wxDefaultSize(-1, -1);
const wxPoint wxDefaultPosition(-1, -1);

View File

@ -1,635 +1,260 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcclient.cpp
// Purpose: wxClientDC class
// Author: AUTHOR
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
// Licence: wxWindows licence
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ===========================================================================
// declarations
// ===========================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "dcclient.h"
#pragma implementation "dcclient.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/string.h"
#include "wx/log.h"
#include "wx/window.h"
#include "wx/msw/private.h"
#include "wx/dcclient.h"
#include "wx/dcmemory.h"
#include "wx/region.h"
#include <math.h>
//-----------------------------------------------------------------------------
// constants
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// array/list types
// ----------------------------------------------------------------------------
#define RAD2DEG 57.2957795131
struct WXDLLEXPORT wxPaintDCInfo
{
wxPaintDCInfo(wxWindow *win, wxDC *dc)
{
hwnd = win->GetHWND();
hdc = dc->GetHDC();
count = 1;
}
//-----------------------------------------------------------------------------
// wxPaintDC
//-----------------------------------------------------------------------------
WXHWND hwnd; // window for this DC
WXHDC hdc; // the DC handle
size_t count; // usage count
};
#include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(wxArrayDCInfo);
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
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)
#endif
/*
* wxWindowDC
*/
// ----------------------------------------------------------------------------
// global variables
// ----------------------------------------------------------------------------
wxWindowDC::wxWindowDC(void)
static PAINTSTRUCT g_paintStruct;
#ifdef __WXDEBUG__
// a global variable which we check to verify that wxPaintDC are only
// created in resopnse to WM_PAINT message - doing this from elsewhere is a
// common programming error among wxWindows programmers and might lead to
// very subtle and difficult to debug refresh/repaint bugs.
int g_isPainting = 0;
#endif // __WXDEBUG__
// ===========================================================================
// implementation
// ===========================================================================
// ----------------------------------------------------------------------------
// wxWindowDC
// ----------------------------------------------------------------------------
wxWindowDC::wxWindowDC()
{
};
m_canvas = NULL;
}
wxWindowDC::wxWindowDC( wxWindow *window )
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
{
};
m_canvas = the_canvas;
m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(the_canvas) );
m_hDCCount++;
wxWindowDC::~wxWindowDC(void)
SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
}
wxWindowDC::~wxWindowDC()
{
};
void wxWindowDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
const wxColour& WXUNUSED(col), int WXUNUSED(style) )
{
};
bool wxWindowDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
{
return FALSE;
};
void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 )
{
if (!Ok()) return;
};
void wxWindowDC::CrossHair( long x, long y )
{
if (!Ok()) return;
};
void wxWindowDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
{
if (!Ok()) return;
long xx1 = XLOG2DEV(x1);
long yy1 = YLOG2DEV(y1);
long xx2 = XLOG2DEV(x2);
long yy2 = YLOG2DEV(y2);
long xxc = XLOG2DEV((long)xc);
long yyc = YLOG2DEV((long)yc);
double dx = xx1 - xxc;
double dy = yy1 - yyc;
double radius = sqrt(dx*dx+dy*dy);
long r = (long)radius;
double radius1, radius2;
if (xx1 == xx2 && yy1 == yy2)
if (m_canvas && m_hDC)
{
radius1 = 0.0;
radius2 = 360.0;
}
else
if (radius == 0.0)
{
radius1 = radius2 = 0.0;
}
else
{
radius1 = (xx1 - xxc == 0) ?
(yy1 - yyc < 0) ? 90.0 : -90.0 :
-atan2(double(yy1-yyc), double(xx1-xxc)) * RAD2DEG;
radius2 = (xx2 - xxc == 0) ?
(yy2 - yyc < 0) ? 90.0 : -90.0 :
-atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG;
};
long alpha1 = long(radius1 * 64.0);
long alpha2 = long((radius2 - radius1) * 64.0);
while (alpha2 <= 0) alpha2 += 360*64;
while (alpha1 > 360*64) alpha1 -= 360*64;
SelectOldObjects(m_hDC);
if (m_brush.GetStyle() != wxTRANSPARENT) {};
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxWindowDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
{
if (!Ok()) return;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = m_signX * XLOG2DEVREL(width);
long hh = m_signY * YLOG2DEVREL(height);
// CMB: handle -ve width and/or height
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
long start = long(sa * 64.0);
long end = long(ea * 64.0);
if (m_brush.GetStyle() != wxTRANSPARENT) {};
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxWindowDC::DrawPoint( long x, long y )
{
if (!Ok()) return;
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxWindowDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
{
if (!Ok()) return;
if (m_pen.GetStyle() == wxTRANSPARENT) return;
for (int i = 0; i < n-1; i++)
{
long x1 = XLOG2DEV(points[i].x + xoffset);
long x2 = XLOG2DEV(points[i+1].x + xoffset);
long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
long y2 = YLOG2DEV(points[i+1].y + yoffset);
};
};
void wxWindowDC::DrawLines( wxList *points, long xoffset, long yoffset )
{
if (!Ok()) return;
if (m_pen.GetStyle() == wxTRANSPARENT) return;
wxNode *node = points->First();
while (node->Next())
{
wxPoint *point = (wxPoint*)node->Data();
wxPoint *npoint = (wxPoint*)node->Next()->Data();
long x1 = XLOG2DEV(point->x + xoffset);
long x2 = XLOG2DEV(npoint->x + xoffset);
long y1 = YLOG2DEV(point->y + yoffset); // and again...
long y2 = YLOG2DEV(npoint->y + yoffset);
node = node->Next();
};
};
void wxWindowDC::DrawPolygon( int WXUNUSED(n), wxPoint WXUNUSED(points)[],
long WXUNUSED(xoffset), long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
{
if (!Ok()) return;
};
void wxWindowDC::DrawPolygon( wxList *WXUNUSED(lines), long WXUNUSED(xoffset),
long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
{
if (!Ok()) return;
};
void wxWindowDC::DrawRectangle( long x, long y, long width, long height )
{
if (!Ok()) return;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = m_signX * XLOG2DEVREL(width);
long hh = m_signY * YLOG2DEVREL(height);
// CMB: draw nothing if transformed w or h is 0
if (ww == 0 || hh == 0) return;
// CMB: handle -ve width and/or height
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
if (m_brush.GetStyle() != wxTRANSPARENT) {};
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxWindowDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
{
if (!Ok()) return;
if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = m_signX * XLOG2DEVREL(width);
long hh = m_signY * YLOG2DEVREL(height);
long rr = XLOG2DEVREL((long)radius);
// CMB: handle -ve width and/or height
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
// CMB: if radius is zero use DrawRectangle() instead to avoid
// X drawing errors with small radii
if (rr == 0)
{
DrawRectangle( x, y, width, height );
return;
//
// In PM one does not explicitly close or release an open WindowDC
// They automatically close with the window, unless explicitly detached
//
m_hDC = 0;
}
// CMB: draw nothing if transformed w or h is 0
if (ww == 0 || hh == 0) return;
m_hDCCount--;
}
// CMB: adjust size if outline is drawn otherwise the result is
// 1 pixel too wide and high
if (m_pen.GetStyle() != wxTRANSPARENT)
// ----------------------------------------------------------------------------
// wxClientDC
// ----------------------------------------------------------------------------
wxClientDC::wxClientDC()
{
m_canvas = NULL;
}
wxClientDC::wxClientDC(wxWindow *the_canvas)
{
m_canvas = the_canvas;
m_hDC = (WXHDC) ::GetDC(GetWinHwnd(the_canvas));
// 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));
}
wxClientDC::~wxClientDC()
{
if ( m_canvas && GetHdc() )
{
ww--;
hh--;
SelectOldObjects(m_hDC);
::ReleaseDC(GetWinHwnd(m_canvas), GetHdc());
m_hDC = 0;
}
}
// CMB: ensure dd is not larger than rectangle otherwise we
// get an hour glass shape
long dd = 2 * rr;
if (dd > ww) dd = ww;
if (dd > hh) dd = hh;
rr = dd / 2;
// ----------------------------------------------------------------------------
// wxPaintDC
// ----------------------------------------------------------------------------
if (m_brush.GetStyle() != wxTRANSPARENT)
{
};
// VZ: initial implementation (by JACS) only remembered the last wxPaintDC
// created and tried to reuse - 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.
//
// I'm not sure how useful this is, however we must remember the HWND
// associated with the last HDC as well - otherwise we may (and will!) try
// to reuse the HDC for another HWND which is a nice recipe for disaster.
//
// So we store a list of windows for which we already have the DC and not
// just one single hDC. This seems to work, but I'm really not sure about
// the usefullness of the whole idea - IMHO it's much better to not call
// base class OnPaint() at all, or, if we really want to allow it, add a
// "wxPaintDC *" parameter to wxPaintEvent which should be used if it's
// !NULL instead of creating a new DC.
if (m_pen.GetStyle() != wxTRANSPARENT)
{
};
};
wxArrayDCInfo wxPaintDC::ms_cache;
void wxWindowDC::DrawEllipse( long x, long y, long width, long height )
wxPaintDC::wxPaintDC()
{
if (!Ok()) return;
m_canvas = NULL;
m_hDC = 0;
}
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = m_signX * XLOG2DEVREL(width);
long hh = m_signY * YLOG2DEVREL(height);
// CMB: handle -ve width and/or height
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
if (m_brush.GetStyle() != wxTRANSPARENT) {};
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
bool wxWindowDC::CanDrawBitmap(void) const
wxPaintDC::wxPaintDC(wxWindow *canvas)
{
return TRUE;
};
wxCHECK_RET( canvas, _T("NULL canvas in wxPaintDC ctor") );
void wxWindowDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
{
if (!Ok()) return;
if (!icon.Ok()) return;
int xx = XLOG2DEV(x);
int yy = YLOG2DEV(y);
};
bool wxWindowDC::Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool WXUNUSED(useMask) )
{
if (!Ok()) return FALSE;
// CMB 20/5/98: add blitting of bitmaps
if (source->IsKindOf(CLASSINFO(wxMemoryDC)))
{
wxMemoryDC* srcDC = (wxMemoryDC*)source;
/*
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
if (bmap)
#ifdef __WXDEBUG__
if ( g_isPainting <= 0 )
{
gdk_draw_bitmap (
m_window,
m_textGC,
bmap,
source->DeviceToLogicalX(xsrc), source->DeviceToLogicalY(ysrc),
XLOG2DEV(xdest), YLOG2DEV(ydest),
source->DeviceToLogicalXRel(width), source->DeviceToLogicalYRel(height)
);
return TRUE;
wxFAIL_MSG( _T("wxPaintDC may be created only in EVT_PAINT handler!") );
return;
}
*/
}
#endif // __WXDEBUG__
return TRUE;
};
m_canvas = canvas;
void wxWindowDC::DrawText( const wxString &text, long x, long y, bool
WXUNUSED(use16) )
{
if (!Ok()) return;
};
bool wxWindowDC::CanGetTextExtent(void) const
{
return TRUE;
};
void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height,
long *WXUNUSED(descent), long *WXUNUSED(externalLeading),
wxFont *WXUNUSED(theFont), bool WXUNUSED(use16) ) const
{
if (!Ok()) return;
};
long wxWindowDC::GetCharWidth(void) const
{
if (!Ok()) return 0;
return 0;
};
long wxWindowDC::GetCharHeight(void) const
{
if (!Ok()) return 0;
return 0;
};
void wxWindowDC::Clear(void)
{
if (!Ok()) return;
};
void wxWindowDC::SetFont( const wxFont &font )
{
if (!Ok()) return;
m_font = font;
};
void wxWindowDC::SetPen( const wxPen &pen )
{
if (!Ok()) return;
if (m_pen == pen) return;
m_pen = pen;
if (!m_pen.Ok()) return;
};
void wxWindowDC::SetBrush( const wxBrush &brush )
{
if (!Ok()) return;
if (m_brush == brush) return;
m_brush = brush;
if (!m_brush.Ok()) return;
};
void wxWindowDC::SetBackground( const wxBrush &brush )
{
if (!Ok()) return;
if (m_backgroundBrush == brush) return;
m_backgroundBrush = brush;
if (!m_backgroundBrush.Ok()) return;
};
void wxWindowDC::SetLogicalFunction( int function )
{
if (m_logicalFunction == function) return;
};
void wxWindowDC::SetTextForeground( const wxColour &col )
{
if (!Ok()) return;
if (m_textForegroundColour == col) return;
m_textForegroundColour = col;
if (!m_textForegroundColour.Ok()) return;
};
void wxWindowDC::SetTextBackground( const wxColour &col )
{
if (!Ok()) return;
if (m_textBackgroundColour == col) return;
m_textBackgroundColour = col;
if (!m_textBackgroundColour.Ok()) return;
};
void wxWindowDC::SetBackgroundMode( int mode )
{
m_backgroundMode = mode;
if (m_brush.GetStyle() != wxSOLID && m_brush.GetStyle() != wxTRANSPARENT)
{
}
};
void wxWindowDC::SetPalette( const wxPalette& WXUNUSED(palette) )
{
};
void wxWindowDC::SetClippingRegion( long x, long y, long width, long height )
{
wxDC::SetClippingRegion( x, y, width, height );
// TODO
};
void wxWindowDC::SetClippingRegion( const wxRegion& region )
{
wxRect box = region.GetBox();
wxDC::SetClippingRegion( box.x, box.y, box.width, box.height );
// TODO
}
void wxWindowDC::DestroyClippingRegion(void)
{
wxDC::DestroyClippingRegion();
};
// ----------------------------------- spline code ----------------------------------------
void wx_quadratic_spline(double a1, double b1, double a2, double b2,
double a3, double b3, double a4, double b4);
void wx_clear_stack(void);
int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, double *x3,
double *y3, double *x4, double *y4);
void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3,
double x4, double y4);
static bool wx_spline_add_point(double x, double y);
static void wx_spline_draw_point_array(wxDC *dc);
wxList wx_spline_point_list;
#define half(z1, z2) ((z1+z2)/2.0)
#define THRESHOLD 5
/* iterative version */
void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4,
double b4)
{
register double xmid, ymid;
double x1, y1, x2, y2, x3, y3, x4, y4;
wx_clear_stack();
wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4);
while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) {
xmid = (double)half(x2, x3);
ymid = (double)half(y2, y3);
if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD &&
fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) {
wx_spline_add_point( x1, y1 );
wx_spline_add_point( xmid, ymid );
} else {
wx_spline_push(xmid, ymid, (double)half(xmid, x3), (double)half(ymid, y3),
(double)half(x3, x4), (double)half(y3, y4), x4, y4);
wx_spline_push(x1, y1, (double)half(x1, x2), (double)half(y1, y2),
(double)half(x2, xmid), (double)half(y2, ymid), xmid, ymid);
}
}
}
/* utilities used by spline drawing routines */
typedef struct wx_spline_stack_struct {
double x1, y1, x2, y2, x3, y3, x4, y4;
} Stack;
#define SPLINE_STACK_DEPTH 20
static Stack wx_spline_stack[SPLINE_STACK_DEPTH];
static Stack *wx_stack_top;
static int wx_stack_count;
void wx_clear_stack(void)
{
wx_stack_top = wx_spline_stack;
wx_stack_count = 0;
}
void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
{
wx_stack_top->x1 = x1;
wx_stack_top->y1 = y1;
wx_stack_top->x2 = x2;
wx_stack_top->y2 = y2;
wx_stack_top->x3 = x3;
wx_stack_top->y3 = y3;
wx_stack_top->x4 = x4;
wx_stack_top->y4 = y4;
wx_stack_top++;
wx_stack_count++;
}
int wx_spline_pop(double *x1, double *y1, double *x2, double *y2,
double *x3, double *y3, double *x4, double *y4)
{
if (wx_stack_count == 0)
return (0);
wx_stack_top--;
wx_stack_count--;
*x1 = wx_stack_top->x1;
*y1 = wx_stack_top->y1;
*x2 = wx_stack_top->x2;
*y2 = wx_stack_top->y2;
*x3 = wx_stack_top->x3;
*y3 = wx_stack_top->y3;
*x4 = wx_stack_top->x4;
*y4 = wx_stack_top->y4;
return (1);
}
static bool wx_spline_add_point(double x, double y)
{
wxPoint *point = new wxPoint ;
point->x = (int) x;
point->y = (int) y;
wx_spline_point_list.Append((wxObject*)point);
return TRUE;
}
static void wx_spline_draw_point_array(wxDC *dc)
{
dc->DrawLines(&wx_spline_point_list, 0, 0 );
wxNode *node = wx_spline_point_list.First();
while (node)
{
wxPoint *point = (wxPoint *)node->Data();
delete point;
delete node;
node = wx_spline_point_list.First();
}
}
void wxWindowDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
double x1, y1, x2, y2;
wxNode *node = points->First();
p = (wxPoint *)node->Data();
x1 = p->x;
y1 = p->y;
node = node->Next();
p = (wxPoint *)node->Data();
x2 = p->x;
y2 = p->y;
cx1 = (double)((x1 + x2) / 2);
cy1 = (double)((y1 + y2) / 2);
cx2 = (double)((cx1 + x2) / 2);
cy2 = (double)((cy1 + y2) / 2);
wx_spline_add_point(x1, y1);
while ((node = node->Next()) != NULL)
// do we have a DC for this window in the cache?
wxPaintDCInfo *info = FindInCache();
if ( info )
{
p = (wxPoint *)node->Data();
x1 = x2;
y1 = y2;
x2 = p->x;
y2 = p->y;
cx4 = (double)(x1 + x2) / 2;
cy4 = (double)(y1 + y2) / 2;
cx3 = (double)(x1 + cx4) / 2;
cy3 = (double)(y1 + cy4) / 2;
wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4);
cx1 = cx4;
cy1 = cy4;
cx2 = (double)(cx1 + x2) / 2;
cy2 = (double)(cy1 + y2) / 2;
m_hDC = info->hdc;
info->count++;
}
else // not in cache, create a new one
{
m_hDC = (WXHDC)::BeginPaint(GetWinHwnd(m_canvas), &g_paintStruct);
ms_cache.Add(new wxPaintDCInfo(m_canvas, this));
}
wx_spline_add_point( cx1, cy1 );
wx_spline_add_point( x2, y2 );
// 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 );
wx_spline_draw_point_array( this );
};
SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
}
wxPaintDC::~wxPaintDC()
{
if ( m_hDC )
{
SelectOldObjects(m_hDC);
size_t index;
wxPaintDCInfo *info = FindInCache(&index);
wxCHECK_RET( info, _T("existing DC should have a cache entry") );
if ( !--info->count )
{
::EndPaint(GetWinHwnd(m_canvas), &g_paintStruct);
ms_cache.Remove(index);
}
//else: cached DC entry is still in use
// prevent the base class dtor from ReleaseDC()ing it again
m_hDC = 0;
}
}
wxPaintDCInfo *wxPaintDC::FindInCache(size_t *index) const
{
wxPaintDCInfo *info = NULL;
size_t nCache = ms_cache.GetCount();
for ( size_t n = 0; n < nCache; n++ )
{
info = &ms_cache[n];
if ( info->hwnd == m_canvas->GetHWND() )
{
if ( index )
*index = n;
break;
}
}
return info;
}

View File

@ -298,6 +298,7 @@ OS2OBJS = \
..\os2\$D\combobox.obj \
..\os2\$D\control.obj \
..\os2\$D\cursor.obj \
..\os2\$D\data.obj \
..\os2\$D\dc.obj \
..\os2\$D\dialog.obj \
..\os2\$D\frame.obj \
@ -319,6 +320,7 @@ OS2LIBOBJS = \
combobox.obj \
control.obj \
cursor.obj \
data.obj \
dc.obj \
dialog.obj \
frame.obj \
@ -484,6 +486,7 @@ $(OS2LIBOBJS):
copy ..\os2\$D\combobox.obj
copy ..\os2\$D\control.obj
copy ..\os2\$D\cursor.obj
copy ..\os2\$D\data.obj
copy ..\os2\$D\dc.obj
copy ..\os2\$D\dialog.obj
copy ..\os2\$D\frame.obj