converted most of X11 DC code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50354 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -22,14 +22,11 @@
|
|||||||
// wxDC
|
// wxDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxDC : public wxDCBase
|
class WXDLLEXPORT wxX11DCImpl : public wxDCImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDC();
|
wxX11DCImpl( wxDC *owner );
|
||||||
virtual ~wxDC() { }
|
virtual ~wxX11DCImpl() { }
|
||||||
|
|
||||||
// implement base class pure virtuals
|
|
||||||
// ----------------------------------
|
|
||||||
|
|
||||||
virtual wxSize GetPPI() const;
|
virtual wxSize GetPPI() const;
|
||||||
|
|
||||||
@@ -49,7 +46,7 @@ protected:
|
|||||||
wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); }
|
wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_ABSTRACT_CLASS(wxDC)
|
DECLARE_CLASS(wxX11DCImpl)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -13,6 +13,8 @@
|
|||||||
#define _WX_DCCLIENT_H_
|
#define _WX_DCCLIENT_H_
|
||||||
|
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
|
#include "wx/dcclient.h"
|
||||||
|
#include "wx/x11/dc.h"
|
||||||
#include "wx/region.h"
|
#include "wx/region.h"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -21,21 +23,17 @@
|
|||||||
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||||
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxWindowDC;
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxPaintDC;
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxClientDC;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxWindowDC
|
// wxWindowDCImpl
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
|
class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxX11DCImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxWindowDC() { Init(); }
|
wxWindowDCImpl( wxDC *owner );
|
||||||
wxWindowDC( wxWindow *win );
|
wxWindowDCImpl( wxDC *owner, wxWindow *win );
|
||||||
|
|
||||||
virtual ~wxWindowDC();
|
virtual ~wxWindowDCImpl();
|
||||||
|
|
||||||
virtual bool CanDrawBitmap() const { return true; }
|
virtual bool CanDrawBitmap() const { return true; }
|
||||||
virtual bool CanGetTextExtent() const { return true; }
|
virtual bool CanGetTextExtent() const { return true; }
|
||||||
@@ -121,7 +119,7 @@ protected:
|
|||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
WXDisplay *m_display;
|
WXDisplay *m_display;
|
||||||
WXWindow m_window;
|
WXWindow m_x11window;
|
||||||
WXGC m_penGC;
|
WXGC m_penGC;
|
||||||
WXGC m_brushGC;
|
WXGC m_brushGC;
|
||||||
WXGC m_textGC;
|
WXGC m_textGC;
|
||||||
@@ -129,7 +127,6 @@ protected:
|
|||||||
WXColormap m_cmap;
|
WXColormap m_cmap;
|
||||||
bool m_isMemDC;
|
bool m_isMemDC;
|
||||||
bool m_isScreenDC;
|
bool m_isScreenDC;
|
||||||
wxWindow *m_owner;
|
|
||||||
wxRegion m_currentClippingRegion;
|
wxRegion m_currentClippingRegion;
|
||||||
wxRegion m_paintClippingRegion;
|
wxRegion m_paintClippingRegion;
|
||||||
|
|
||||||
@@ -142,38 +139,38 @@ protected:
|
|||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxWindowDC)
|
DECLARE_CLASS(wxWindowDCImpl)
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxClientDC
|
// wxClientDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
|
class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxClientDC() { }
|
wxClientDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) { }
|
||||||
wxClientDC( wxWindow *win );
|
wxClientDCImpl( wxDC *owner, wxWindow *win );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoGetSize(int *width, int *height) const;
|
virtual void DoGetSize(int *width, int *height) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxClientDC)
|
DECLARE_CLASS(wxClientDCImpl)
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxPaintDC
|
// wxPaintDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
|
class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxPaintDC() { }
|
wxPaintDCImpl( wxDC *owner ) : wxClientDCImpl( owner ) { }
|
||||||
wxPaintDC( wxWindow *win );
|
wxPaintDCImpl( wxDC *owner, wxWindow *win );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxPaintDC)
|
DECLARE_CLASS(wxPaintDCImpl)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -12,16 +12,21 @@
|
|||||||
#ifndef _WX_DCMEMORY_H_
|
#ifndef _WX_DCMEMORY_H_
|
||||||
#define _WX_DCMEMORY_H_
|
#define _WX_DCMEMORY_H_
|
||||||
|
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dc.h"
|
||||||
|
#include "wx/dcmemory.h"
|
||||||
|
#include "wx/x11/dcclient.h"
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase
|
class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMemoryDC() { Init(); }
|
wxMemoryDCImpl( wxDC* owner );
|
||||||
wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
|
wxMemoryDCImpl( wxDC* owner, wxBitmap& bitmap);
|
||||||
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
wxMemoryDCImpl( wxDC* owner, wxDC *dc );
|
||||||
virtual ~wxMemoryDC();
|
virtual ~wxMemoryDCImpl();
|
||||||
|
|
||||||
|
virtual const wxBitmap& GetSelectedBitmap() const;
|
||||||
|
virtual wxBitmap& GetSelectedBitmap();
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
wxBitmap m_selected;
|
wxBitmap m_selected;
|
||||||
|
|
||||||
@@ -32,7 +37,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
private:
|
||||||
|
DECLARE_CLASS(wxMemoryDCImpl)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -13,18 +13,20 @@
|
|||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
|
#include "wx/x11/dc.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/dcmemory.h"
|
#include "wx/dcmemory.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxX11DCImpl, wxDCImpl)
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxDC
|
// wxDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxDC::wxDC()
|
wxX11DCImpl::wxX11DCImpl( wxDC *owner ) :
|
||||||
|
wxDCImpl( owner )
|
||||||
{
|
{
|
||||||
m_ok = false;
|
m_ok = false;
|
||||||
|
|
||||||
@@ -35,7 +37,7 @@ wxDC::wxDC()
|
|||||||
m_backgroundMode = wxTRANSPARENT;
|
m_backgroundMode = wxTRANSPARENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
void wxX11DCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||||
{
|
{
|
||||||
m_clipping = true;
|
m_clipping = true;
|
||||||
m_clipX1 = x;
|
m_clipX1 = x;
|
||||||
@@ -44,10 +46,10 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
|||||||
m_clipY2 = y + height;
|
m_clipY2 = y + height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoGetSizeMM( int* width, int* height ) const
|
void wxX11DCImpl::DoGetSizeMM( int* width, int* height ) const
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
GetSize( &w, &h );
|
DoGetSize( &w, &h );
|
||||||
|
|
||||||
if ( width )
|
if ( width )
|
||||||
*width = int( double(w) / (m_scaleX*m_mm_to_pix_x) );
|
*width = int( double(w) / (m_scaleX*m_mm_to_pix_x) );
|
||||||
@@ -56,7 +58,7 @@ void wxDC::DoGetSizeMM( int* width, int* height ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolution in pixels per logical inch
|
// Resolution in pixels per logical inch
|
||||||
wxSize wxDC::GetPPI() const
|
wxSize wxX11DCImpl::GetPPI() const
|
||||||
{
|
{
|
||||||
// TODO (should probably be pure virtual)
|
// TODO (should probably be pure virtual)
|
||||||
return wxSize(0, 0);
|
return wxSize(0, 0);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -20,10 +20,30 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/x11/private.h"
|
#include "wx/x11/private.h"
|
||||||
|
#include "wx/x11/dcmemory.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
|
IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl,wxWindowDCImpl)
|
||||||
|
|
||||||
void wxMemoryDC::Init()
|
wxMemoryDCImpl::wxMemoryDCImpl( wxDC *owner )
|
||||||
|
: wxWindowDCImpl( owner )
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxMemoryDCImpl::wxMemoryDCImpl( wxDC *owner, wxBitmap& bitmap )
|
||||||
|
: wxWindowDCImpl( owner )
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
DoSelect(bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxMemoryDCImpl::wxMemoryDCImpl( wxDC* owner, wxDC *WXUNUSED(dc) )
|
||||||
|
: wxWindowDCImpl( owner )
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMemoryDCImpl::Init()
|
||||||
{
|
{
|
||||||
m_ok = false;
|
m_ok = false;
|
||||||
|
|
||||||
@@ -33,17 +53,11 @@ void wxMemoryDC::Init()
|
|||||||
m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
|
m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
wxMemoryDCImpl::~wxMemoryDCImpl()
|
||||||
: wxWindowDC()
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMemoryDC::~wxMemoryDC()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
|
void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
|
|
||||||
@@ -52,11 +66,11 @@ void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
|
|||||||
{
|
{
|
||||||
if (m_selected.GetPixmap())
|
if (m_selected.GetPixmap())
|
||||||
{
|
{
|
||||||
m_window = (WXWindow) m_selected.GetPixmap();
|
m_x11window = (WXWindow) m_selected.GetPixmap();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_window = m_selected.GetBitmap();
|
m_x11window = m_selected.GetBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isMemDC = true;
|
m_isMemDC = true;
|
||||||
@@ -66,11 +80,11 @@ void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ok = false;
|
m_ok = false;
|
||||||
m_window = NULL;
|
m_x11window = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::DoGetSize( int *width, int *height ) const
|
void wxMemoryDCImpl::DoGetSize( int *width, int *height ) const
|
||||||
{
|
{
|
||||||
if (m_selected.Ok())
|
if (m_selected.Ok())
|
||||||
{
|
{
|
||||||
@@ -83,3 +97,13 @@ void wxMemoryDC::DoGetSize( int *width, int *height ) const
|
|||||||
if (height) (*height) = 0;
|
if (height) (*height) = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wxBitmap& wxMemoryDCImpl::GetSelectedBitmap() const
|
||||||
|
{
|
||||||
|
return m_selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxBitmap& wxMemoryDCImpl::GetSelectedBitmap()
|
||||||
|
{
|
||||||
|
return m_selected;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user