More Motif stuff

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@763 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-09-20 20:59:30 +00:00
parent b112d15289
commit dfc5454127
29 changed files with 1355 additions and 371 deletions

View File

@@ -15,8 +15,13 @@
#include "wx/dcclient.h"
#include "wx/dcmemory.h"
#include "wx/window.h"
#include <math.h>
#include <Xm/Xm.h>
#include "wx/motif/private.h"
//-----------------------------------------------------------------------------
// constants
//-----------------------------------------------------------------------------
@@ -24,51 +29,114 @@
#define RAD2DEG 57.2957795131
//-----------------------------------------------------------------------------
// wxPaintDC
// wxWindowDC
//-----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
//IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxDC)
//IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
#endif
wxPaintDC::wxPaintDC(void)
wxWindowDC::wxWindowDC(void)
{
m_gc = (WXGC) 0;
m_gcBacking = (WXGC) 0;
m_window = NULL;
m_backgroundPixel = -1;
m_currentPenWidth = 1;
m_currentPenJoin = -1;
m_currentPenDashCount = -1;
m_currentPenDash = (char*) NULL;
m_currentStyle = -1;
m_currentFill = -1;
m_currentBkMode = wxTRANSPARENT;
m_colour = wxColourDisplay();
m_display = (WXDisplay*) NULL;
m_clippingRegion = (WXRegion) 0;
};
wxPaintDC::wxPaintDC( wxWindow *window )
wxWindowDC::wxWindowDC( wxWindow *window )
{
m_window = window;
m_gc = (WXGC) 0;
m_gcBacking = (WXGC) 0;
m_window = NULL;
m_backgroundPixel = -1;
m_currentPenWidth = 1;
m_currentPenJoin = -1;
m_currentPenDashCount = -1;
m_currentPenDash = (char*) NULL;
m_currentStyle = -1;
m_currentFill = -1;
m_currentBkMode = wxTRANSPARENT;
m_colour = wxColourDisplay();
m_display = window->GetXDisplay();
m_clippingRegion = (WXRegion) 0;
m_ok = TRUE;
};
wxPaintDC::~wxPaintDC(void)
wxWindowDC::~wxWindowDC(void)
{
if (m_gc)
XFreeGC ((Display*) m_display, (GC) m_gc);
m_gc = (WXGC) 0;
if (m_gcBacking)
XFreeGC ((Display*) m_display, (GC) m_gcBacking);
m_gcBacking = (WXGC) 0;
if (m_clippingRegion)
XDestroyRegion ((Region) m_clippingRegion);
m_clippingRegion = (WXRegion) 0;
};
void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
void wxWindowDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
wxColour* WXUNUSED(col), int WXUNUSED(style) )
{
};
bool wxPaintDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
bool wxWindowDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
{
return FALSE;
};
void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 )
{
if (!Ok()) return;
#if 0
int x1d, y1d, x2d, y2d;
/* MATTHEW: [7] Implement GetPixel */
FreeGetPixelCache();
x1d = XLOG2DEV(x1);
y1d = YLOG2DEV(y1);
x2d = XLOG2DEV(x2);
y2d = YLOG2DEV(y2);
if (current_pen && autoSetting)
SetPen (current_pen);
XDrawLine (display, pixmap, gc, x1d, y1d, x2d, y2d);
if (canvas && canvas->is_retained)
XDrawLine (display, canvas->backingPixmap, gcBacking,
XLOG2DEV_2(x1), YLOG2DEV_2(y1),
XLOG2DEV_2(x2), YLOG2DEV_2(y2));
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
#endif
};
void wxWindowDC::CrossHair( long x, long y )
{
if (!Ok()) return;
};
void wxPaintDC::CrossHair( long x, long y )
{
if (!Ok()) return;
};
void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
void wxWindowDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
{
if (!Ok()) return;
@@ -114,7 +182,7 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
};
void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
void wxWindowDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
{
if (!Ok()) return;
@@ -134,14 +202,14 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxPaintDC::DrawPoint( long x, long y )
void wxWindowDC::DrawPoint( long x, long y )
{
if (!Ok()) return;
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
void wxWindowDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
{
if (!Ok()) return;
@@ -156,7 +224,7 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
};
};
void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
void wxWindowDC::DrawLines( wxList *points, long xoffset, long yoffset )
{
if (!Ok()) return;
@@ -175,19 +243,19 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
};
};
void wxPaintDC::DrawPolygon( int WXUNUSED(n), wxPoint WXUNUSED(points)[],
void wxWindowDC::DrawPolygon( int WXUNUSED(n), wxPoint WXUNUSED(points)[],
long WXUNUSED(xoffset), long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
{
if (!Ok()) return;
};
void wxPaintDC::DrawPolygon( wxList *WXUNUSED(lines), long WXUNUSED(xoffset),
void wxWindowDC::DrawPolygon( wxList *WXUNUSED(lines), long WXUNUSED(xoffset),
long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
{
if (!Ok()) return;
};
void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
void wxWindowDC::DrawRectangle( long x, long y, long width, long height )
{
if (!Ok()) return;
@@ -208,7 +276,7 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
void wxWindowDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
{
if (!Ok()) return;
@@ -259,7 +327,7 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
};
};
void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
void wxWindowDC::DrawEllipse( long x, long y, long width, long height )
{
if (!Ok()) return;
@@ -277,12 +345,12 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
bool wxPaintDC::CanDrawBitmap(void) const
bool wxWindowDC::CanDrawBitmap(void) const
{
return TRUE;
};
void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
void wxWindowDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
{
if (!Ok()) return;
@@ -293,7 +361,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
};
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
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;
@@ -322,7 +390,7 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
return TRUE;
};
void wxPaintDC::DrawText( const wxString &text, long x, long y, bool
void wxWindowDC::DrawText( const wxString &text, long x, long y, bool
WXUNUSED(use16) )
{
if (!Ok()) return;
@@ -331,12 +399,12 @@ WXUNUSED(use16) )
bool wxPaintDC::CanGetTextExtent(void) const
bool wxWindowDC::CanGetTextExtent(void) const
{
return TRUE;
};
void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height,
void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height,
long *WXUNUSED(descent), long *WXUNUSED(externalLeading),
wxFont *WXUNUSED(theFont), bool WXUNUSED(use16) )
{
@@ -344,32 +412,32 @@ void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height
};
long wxPaintDC::GetCharWidth(void)
long wxWindowDC::GetCharWidth(void)
{
if (!Ok()) return 0;
return 0;
};
long wxPaintDC::GetCharHeight(void)
long wxWindowDC::GetCharHeight(void)
{
if (!Ok()) return 0;
return 0;
};
void wxPaintDC::Clear(void)
void wxWindowDC::Clear(void)
{
if (!Ok()) return;
};
void wxPaintDC::SetFont( const wxFont &font )
void wxWindowDC::SetFont( const wxFont &font )
{
if (!Ok()) return;
m_font = font;
};
void wxPaintDC::SetPen( const wxPen &pen )
void wxWindowDC::SetPen( const wxPen &pen )
{
if (!Ok()) return;
@@ -380,7 +448,7 @@ void wxPaintDC::SetPen( const wxPen &pen )
if (!m_pen.Ok()) return;
};
void wxPaintDC::SetBrush( const wxBrush &brush )
void wxWindowDC::SetBrush( const wxBrush &brush )
{
if (!Ok()) return;
@@ -392,7 +460,7 @@ void wxPaintDC::SetBrush( const wxBrush &brush )
};
void wxPaintDC::SetBackground( const wxBrush &brush )
void wxWindowDC::SetBackground( const wxBrush &brush )
{
if (!Ok()) return;
@@ -404,12 +472,12 @@ void wxPaintDC::SetBackground( const wxBrush &brush )
};
void wxPaintDC::SetLogicalFunction( int function )
void wxWindowDC::SetLogicalFunction( int function )
{
if (m_logicalFunction == function) return;
};
void wxPaintDC::SetTextForeground( const wxColour &col )
void wxWindowDC::SetTextForeground( const wxColour &col )
{
if (!Ok()) return;
@@ -419,7 +487,7 @@ void wxPaintDC::SetTextForeground( const wxColour &col )
if (!m_textForegroundColour.Ok()) return;
};
void wxPaintDC::SetTextBackground( const wxColour &col )
void wxWindowDC::SetTextBackground( const wxColour &col )
{
if (!Ok()) return;
@@ -429,7 +497,7 @@ void wxPaintDC::SetTextBackground( const wxColour &col )
if (!m_textBackgroundColour.Ok()) return;
};
void wxPaintDC::SetBackgroundMode( int mode )
void wxWindowDC::SetBackgroundMode( int mode )
{
m_backgroundMode = mode;
@@ -438,17 +506,17 @@ void wxPaintDC::SetBackgroundMode( int mode )
}
};
void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) )
void wxWindowDC::SetPalette( const wxPalette& WXUNUSED(palette) )
{
};
void wxPaintDC::SetClippingRegion( long x, long y, long width, long height )
void wxWindowDC::SetClippingRegion( long x, long y, long width, long height )
{
wxDC::SetClippingRegion( x, y, width, height );
};
void wxPaintDC::DestroyClippingRegion(void)
void wxWindowDC::DestroyClippingRegion(void)
{
wxDC::DestroyClippingRegion();
@@ -569,7 +637,7 @@ static void wx_spline_draw_point_array(wxDC *dc)
}
}
void wxPaintDC::DrawOpenSpline( wxList *points )
void wxWindowDC::DrawOpenSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;