*** empty log message ***
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3788 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -81,7 +81,9 @@ public:
|
||||
wxPalette m_bitmapPalette;
|
||||
int m_quality;
|
||||
|
||||
/* WXHBITMAP m_hBitmap; TODO: platform-specific handle */
|
||||
WXHBITMAP m_hBitmap;
|
||||
wxDC * m_selectedInto; // So bitmap knows whether it's been selected into
|
||||
|
||||
wxMask * m_bitmapMask; // Optional mask
|
||||
};
|
||||
|
||||
@@ -184,14 +186,13 @@ public:
|
||||
protected:
|
||||
static wxList sm_handlers;
|
||||
|
||||
/*
|
||||
// TODO: Implementation
|
||||
public:
|
||||
void SetHBITMAP(WXHBITMAP bmp);
|
||||
inline WXHBITMAP GetHBITMAP() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hBitmap : 0); }
|
||||
bool FreeResource(bool force = FALSE);
|
||||
*/
|
||||
|
||||
inline void SetSelectedInto(wxDC *dc) { if (M_BITMAPDATA) M_BITMAPDATA->m_selectedInto = dc; }
|
||||
inline wxDC *GetSelectedInto(void) const { return (M_BITMAPDATA ? M_BITMAPDATA->m_selectedInto : (wxDC*) NULL); }
|
||||
// bool FreeResource(bool force = FALSE);
|
||||
};
|
||||
#endif
|
||||
// _WX_BITMAP_H_
|
||||
|
@@ -155,6 +155,20 @@ class WXDLLEXPORT wxDC: public wxDCBase
|
||||
virtual void SetInternalDeviceOrigin( long x, long y );
|
||||
virtual void GetInternalDeviceOrigin( long *x, long *y );
|
||||
|
||||
virtual void SetRop(WXHDC cdc);
|
||||
virtual void DoClipping(WXHDC cdc);
|
||||
virtual void SelectOldObjects(WXHDC dc);
|
||||
|
||||
wxWindow *GetWindow() const { return m_canvas; }
|
||||
void SetWindow(wxWindow *win) { m_canvas = win; }
|
||||
|
||||
WXHDC GetHDC() const { return m_hDC; }
|
||||
void SetHDC(WXHDC dc, bool bOwnsDC = FALSE)
|
||||
{
|
||||
m_hDC = dc;
|
||||
m_bOwnsDC = bOwnsDC;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
@@ -177,13 +191,14 @@ protected:
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// Owner canvas and selected in bitmap (if bitmap is GDI object selected)
|
||||
wxWindow* m_owner;
|
||||
wxBitmap* m_bitmap;
|
||||
wxWindow* m_canvas;
|
||||
wxBitmap m_selectedBitmap;
|
||||
|
||||
// our HDC and its usage count: we only free it when the usage count drops
|
||||
// to 0
|
||||
WXHDC m_hDC;
|
||||
int m_hDCCount;
|
||||
bool m_bOwnsDC:1;
|
||||
|
||||
// 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
|
||||
|
@@ -47,6 +47,12 @@ public:
|
||||
wxWindowDC(wxWindow *win);
|
||||
|
||||
virtual ~wxWindowDC();
|
||||
|
||||
// PM specific stuff
|
||||
HPS m_hPS;
|
||||
private:
|
||||
HAB m_hab;
|
||||
SIZEL m_PageSize;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxClientDC : public wxWindowDC
|
||||
|
@@ -25,11 +25,12 @@ class WXDLLEXPORT wxMemoryDC: public wxPaintDC
|
||||
public:
|
||||
wxMemoryDC(void);
|
||||
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
||||
|
||||
~wxMemoryDC(void);
|
||||
virtual void SelectObject( const wxBitmap& bitmap );
|
||||
void GetSize( int *width, int *height ) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
friend wxPaintDC;
|
||||
wxBitmap m_selected;
|
||||
};
|
||||
|
@@ -16,19 +16,40 @@
|
||||
#pragma interface "dcprint.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
|
||||
#include "wx/dc.h"
|
||||
#include "wx/cmndata.h"
|
||||
|
||||
class WXDLLEXPORT wxPrinterDC: public wxDC
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS(wxPrinterDC)
|
||||
|
||||
// Create a printer DC
|
||||
wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, int orientation = wxPORTRAIT);
|
||||
// Create a printer DC [obsolete]
|
||||
wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, int orientation = wxPORTRAIT);
|
||||
|
||||
~wxPrinterDC();
|
||||
// Create from print data
|
||||
wxPrinterDC(const wxPrintData& data);
|
||||
|
||||
wxPrinterDC(WXHDC theDC);
|
||||
|
||||
~wxPrinterDC();
|
||||
|
||||
bool StartDoc(const wxString& message);
|
||||
void EndDoc(void);
|
||||
void StartPage(void);
|
||||
void EndPage(void);
|
||||
|
||||
protected:
|
||||
wxPrintData m_printData;
|
||||
};
|
||||
|
||||
// Gets an HDC for the specified printer configuration
|
||||
WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data);
|
||||
|
||||
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||
|
||||
#endif
|
||||
// _WX_DCPRINT_H_
|
||||
|
||||
|
@@ -428,3 +428,12 @@ void wxBitmap::InitStandardHandlers()
|
||||
AddHandler(new wxICOFileHandler);
|
||||
*/
|
||||
}
|
||||
|
||||
void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
|
||||
{
|
||||
if (!M_BITMAPDATA)
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
M_BITMAPDATA->m_hBitmap = bmp;
|
||||
}
|
||||
|
||||
|
@@ -108,14 +108,15 @@ long wxDCBase::LogicalToDeviceYRel(long y) const
|
||||
|
||||
wxDC::wxDC(void)
|
||||
{
|
||||
m_owner = NULL;
|
||||
m_bitmap = NULL;
|
||||
m_canvas = NULL;
|
||||
|
||||
m_oldBitmap = 0;
|
||||
m_oldPen = 0;
|
||||
m_oldBrush = 0;
|
||||
m_oldFont = 0;
|
||||
m_oldPalette = 0;
|
||||
|
||||
m_bOwnsDC = FALSE;
|
||||
m_hDC = 0;
|
||||
m_hDCCount = 0;
|
||||
};
|
||||
@@ -393,6 +394,94 @@ void wxDC::DoDrawSpline(wxList *points)
|
||||
}
|
||||
#endif
|
||||
|
||||
void wxDC::SetRop(WXHDC dc)
|
||||
{
|
||||
if (!dc || m_logicalFunction < 0)
|
||||
return;
|
||||
|
||||
int c_rop;
|
||||
// These may be wrong
|
||||
switch (m_logicalFunction)
|
||||
{
|
||||
// TODO: Figure this stuff out
|
||||
// case wxXOR: c_rop = R2_XORPEN; break;
|
||||
// case wxXOR: c_rop = R2_NOTXORPEN; break;
|
||||
// case wxINVERT: c_rop = R2_NOT; break;
|
||||
// case wxOR_REVERSE: c_rop = R2_MERGEPENNOT; break;
|
||||
// case wxAND_REVERSE: c_rop = R2_MASKPENNOT; break;
|
||||
// case wxCLEAR: c_rop = R2_WHITE; break;
|
||||
// case wxSET: c_rop = R2_BLACK; break;
|
||||
// case wxSRC_INVERT: c_rop = R2_NOTCOPYPEN; break;
|
||||
// case wxOR_INVERT: c_rop = R2_MERGENOTPEN; break;
|
||||
// case wxAND: c_rop = R2_MASKPEN; break;
|
||||
// case wxOR: c_rop = R2_MERGEPEN; break;
|
||||
// case wxAND_INVERT: c_rop = R2_MASKNOTPEN; break;
|
||||
// case wxEQUIV:
|
||||
// case wxNAND:
|
||||
// case wxCOPY:
|
||||
default:
|
||||
// c_rop = R2_COPYPEN;
|
||||
break;
|
||||
}
|
||||
// SetROP2((HDC) dc, c_rop);
|
||||
}
|
||||
|
||||
void wxDC::DoClipping(WXHDC dc)
|
||||
{
|
||||
if (m_clipping && dc)
|
||||
{
|
||||
// TODO:
|
||||
// IntersectClipRect((HDC) dc, XLOG2DEV(m_clipX1), YLOG2DEV(m_clipY1),
|
||||
// XLOG2DEV(m_clipX2), YLOG2DEV(m_clipY2));
|
||||
}
|
||||
}
|
||||
|
||||
// This will select current objects out of the DC,
|
||||
// which is what you have to do before deleting the
|
||||
// DC.
|
||||
void wxDC::SelectOldObjects(WXHDC dc)
|
||||
{
|
||||
if (dc)
|
||||
{
|
||||
if (m_oldBitmap)
|
||||
{
|
||||
// ::SelectObject((HDC) dc, (HBITMAP) m_oldBitmap);
|
||||
if (m_selectedBitmap.Ok())
|
||||
{
|
||||
m_selectedBitmap.SetSelectedInto(NULL);
|
||||
}
|
||||
}
|
||||
m_oldBitmap = 0;
|
||||
if (m_oldPen)
|
||||
{
|
||||
// ::SelectObject((HDC) dc, (HPEN) m_oldPen);
|
||||
}
|
||||
m_oldPen = 0;
|
||||
if (m_oldBrush)
|
||||
{
|
||||
// ::SelectObject((HDC) dc, (HBRUSH) m_oldBrush);
|
||||
}
|
||||
m_oldBrush = 0;
|
||||
if (m_oldFont)
|
||||
{
|
||||
// ::SelectObject((HDC) dc, (HFONT) m_oldFont);
|
||||
}
|
||||
m_oldFont = 0;
|
||||
if (m_oldPalette)
|
||||
{
|
||||
// ::SelectPalette((HDC) dc, (HPALETTE) m_oldPalette, TRUE);
|
||||
}
|
||||
m_oldPalette = 0;
|
||||
}
|
||||
|
||||
m_brush = wxNullBrush;
|
||||
m_pen = wxNullPen;
|
||||
m_palette = wxNullPalette;
|
||||
m_font = wxNullFont;
|
||||
m_backgroundBrush = wxNullBrush;
|
||||
m_selectedBitmap = wxNullBitmap;
|
||||
}
|
||||
|
||||
//
|
||||
// Private functions
|
||||
//
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include "wx/log.h"
|
||||
#include "wx/window.h"
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
#include "wx/os2/private.h"
|
||||
|
||||
#include "wx/dcclient.h"
|
||||
|
||||
@@ -72,7 +72,7 @@ WX_DEFINE_OBJARRAY(wxArrayDCInfo);
|
||||
// global variables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static PAINTSTRUCT g_paintStruct;
|
||||
static RECT g_paintStruct;
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
// a global variable which we check to verify that wxPaintDC are only
|
||||
@@ -100,7 +100,19 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas)
|
||||
m_canvas = the_canvas;
|
||||
m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(the_canvas) );
|
||||
m_hDCCount++;
|
||||
|
||||
//
|
||||
// default under PM is that Window and Client DC's are the same
|
||||
// so we offer a separate Presentation Space to use for the
|
||||
// entire window. Otherwise, calling BeginPaint will just create
|
||||
// chached-micro client presentation space
|
||||
//
|
||||
m_hPS = GpiCreatePS( m_hab
|
||||
,m_hDC
|
||||
,&m_PageSize
|
||||
,PU_PELS | GPIF_LONG | GPIA_ASSOC
|
||||
);
|
||||
::GpiAssociate(m_hPS, NULLHANDLE);
|
||||
::GpiAssociate(m_hPS, m_hDC);
|
||||
SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
|
||||
}
|
||||
|
||||
@@ -113,8 +125,12 @@ wxWindowDC::~wxWindowDC()
|
||||
//
|
||||
// In PM one does not explicitly close or release an open WindowDC
|
||||
// They automatically close with the window, unless explicitly detached
|
||||
// but we need to destroy our PS
|
||||
//
|
||||
m_hDC = 0;
|
||||
::GpiAssociate(m_hPS, NULLHANDLE);
|
||||
::GpiDestroyPS(m_hPS);
|
||||
m_hPS = NULLHANDLE;
|
||||
m_hDC = NULLHANDLE;
|
||||
}
|
||||
|
||||
m_hDCCount--;
|
||||
@@ -132,13 +148,15 @@ wxClientDC::wxClientDC()
|
||||
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 );
|
||||
//
|
||||
// default under PM is that Window and Client DC's are the same
|
||||
//
|
||||
m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(the_canvas));
|
||||
|
||||
//
|
||||
// Default mode is BM_LEAVEALONE so we make no call Set the mix
|
||||
//
|
||||
SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
|
||||
}
|
||||
|
||||
@@ -148,7 +166,9 @@ wxClientDC::~wxClientDC()
|
||||
{
|
||||
SelectOldObjects(m_hDC);
|
||||
|
||||
::ReleaseDC(GetWinHwnd(m_canvas), GetHdc());
|
||||
// We don't explicitly release Device contexts in PM and
|
||||
// the cached micro PS is already gone
|
||||
|
||||
m_hDC = 0;
|
||||
}
|
||||
}
|
||||
@@ -205,15 +225,9 @@ wxPaintDC::wxPaintDC(wxWindow *canvas)
|
||||
}
|
||||
else // not in cache, create a new one
|
||||
{
|
||||
m_hDC = (WXHDC)::BeginPaint(GetWinHwnd(m_canvas), &g_paintStruct);
|
||||
m_hDC = (WXHDC)::WinBeginPaint(GetWinHwnd(m_canvas), NULLHANDLE, &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));
|
||||
}
|
||||
|
||||
@@ -230,7 +244,7 @@ wxPaintDC::~wxPaintDC()
|
||||
|
||||
if ( !--info->count )
|
||||
{
|
||||
::EndPaint(GetWinHwnd(m_canvas), &g_paintStruct);
|
||||
::WinEndPaint(m_hPS);
|
||||
|
||||
ms_cache.Remove(index);
|
||||
}
|
||||
|
@@ -201,7 +201,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
|
||||
dc.SetFont(statusBar->GetFont());
|
||||
|
||||
long x, y;
|
||||
dc.GetTextExtent("X", &x, &y, NULL, NULL, NULL, FALSE);
|
||||
dc.GetTextExtent("X", &x, &y, NULL, NULL, NULL);
|
||||
|
||||
int height = (int)( (y * 1.1) + 2* statusBar->GetBorderY());
|
||||
|
||||
|
@@ -300,6 +300,10 @@ OS2OBJS = \
|
||||
..\os2\$D\cursor.obj \
|
||||
..\os2\$D\data.obj \
|
||||
..\os2\$D\dc.obj \
|
||||
..\os2\$D\dcclient.obj \
|
||||
..\os2\$D\dcmemory.obj \
|
||||
..\os2\$D\dcprint.obj \
|
||||
..\os2\$D\dcscreen.obj \
|
||||
..\os2\$D\dialog.obj \
|
||||
..\os2\$D\frame.obj \
|
||||
..\os2\$D\window.obj
|
||||
@@ -322,6 +326,10 @@ OS2LIBOBJS = \
|
||||
cursor.obj \
|
||||
data.obj \
|
||||
dc.obj \
|
||||
dcclient.obj \
|
||||
dcmemory.obj \
|
||||
dcprint.obj \
|
||||
dcscreen.obj \
|
||||
dialog.obj \
|
||||
frame.obj \
|
||||
window.obj
|
||||
@@ -488,6 +496,10 @@ $(OS2LIBOBJS):
|
||||
copy ..\os2\$D\cursor.obj
|
||||
copy ..\os2\$D\data.obj
|
||||
copy ..\os2\$D\dc.obj
|
||||
copy ..\os2\$D\dcclient.obj
|
||||
copy ..\os2\$D\dcmemory.obj
|
||||
copy ..\os2\$D\dcprint.obj
|
||||
copy ..\os2\$D\dcscreen.obj
|
||||
copy ..\os2\$D\dialog.obj
|
||||
copy ..\os2\$D\frame.obj
|
||||
copy ..\os2\$D\window.obj
|
||||
|
Reference in New Issue
Block a user