Move code to a dcbase.cpp
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2569 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
7740bc4143
commit
bd5dd95757
@ -122,23 +122,7 @@ public:
|
|||||||
|
|
||||||
void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0)
|
void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0)
|
||||||
{ DoDrawLines(n, points, xoffset, yoffset); }
|
{ DoDrawLines(n, points, xoffset, yoffset); }
|
||||||
void DrawLines(const wxList *list, long xoffset = 0, long yoffset = 0)
|
void DrawLines(const wxList *list, long xoffset = 0, long yoffset = 0);
|
||||||
{
|
|
||||||
int n = list->Number();
|
|
||||||
wxPoint *points = new wxPoint[n];
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for ( wxNode *node = list->First(); node; node = node->Next(), i++ )
|
|
||||||
{
|
|
||||||
wxPoint *point = (wxPoint *)node->Data();
|
|
||||||
points[i].x = point->x;
|
|
||||||
points[i].y = point->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoDrawLines(n, points, xoffset, yoffset);
|
|
||||||
|
|
||||||
delete [] points;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawPolygon(int n, wxPoint points[],
|
void DrawPolygon(int n, wxPoint points[],
|
||||||
long xoffset = 0, long yoffset = 0,
|
long xoffset = 0, long yoffset = 0,
|
||||||
@ -147,23 +131,7 @@ public:
|
|||||||
|
|
||||||
void DrawPolygon(const wxList *list,
|
void DrawPolygon(const wxList *list,
|
||||||
long xoffset = 0, long yoffset = 0,
|
long xoffset = 0, long yoffset = 0,
|
||||||
int fillStyle = wxODDEVEN_RULE)
|
int fillStyle = wxODDEVEN_RULE);
|
||||||
{
|
|
||||||
int n = list->Number();
|
|
||||||
wxPoint *points = new wxPoint[n];
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for ( wxNode *node = list->First(); node; node = node->Next(), i++ )
|
|
||||||
{
|
|
||||||
wxPoint *point = (wxPoint *)node->Data();
|
|
||||||
points[i].x = point->x;
|
|
||||||
points[i].y = point->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoDrawPolygon(n, points, xoffset, yoffset, fillStyle);
|
|
||||||
|
|
||||||
delete [] points;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawRectangle(long x, long y, long width, long height)
|
void DrawRectangle(long x, long y, long width, long height)
|
||||||
{ DoDrawRectangle(x, y, width, height); }
|
{ DoDrawRectangle(x, y, width, height); }
|
||||||
@ -222,42 +190,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_SPLINES
|
#if wxUSE_SPLINES
|
||||||
// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
|
// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
|
||||||
void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3)
|
void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3);
|
||||||
{
|
void DrawSpline(int n, wxPoint points[]);
|
||||||
wxList point_list;
|
|
||||||
|
|
||||||
wxPoint *point1 = new wxPoint;
|
|
||||||
point1->x = x1; point1->y = y1;
|
|
||||||
point_list.Append((wxObject*)point1);
|
|
||||||
|
|
||||||
wxPoint *point2 = new wxPoint;
|
|
||||||
point2->x = x2; point2->y = y2;
|
|
||||||
point_list.Append((wxObject*)point2);
|
|
||||||
|
|
||||||
wxPoint *point3 = new wxPoint;
|
|
||||||
point3->x = x3; point3->y = y3;
|
|
||||||
point_list.Append((wxObject*)point3);
|
|
||||||
|
|
||||||
DrawSpline(&point_list);
|
|
||||||
|
|
||||||
for( wxNode *node = point_list.First(); node; node = node->Next() )
|
|
||||||
{
|
|
||||||
wxPoint *p = (wxPoint *)node->Data();
|
|
||||||
delete p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawSpline(int n, wxPoint points[])
|
|
||||||
{
|
|
||||||
wxList list;
|
|
||||||
for (int i =0; i < n; i++)
|
|
||||||
{
|
|
||||||
list.Append((wxObject*)&points[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawSpline(&list);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawSpline(wxList *points) { DoDrawSpline(points); }
|
void DrawSpline(wxList *points) { DoDrawSpline(points); }
|
||||||
#endif // wxUSE_SPLINES
|
#endif // wxUSE_SPLINES
|
||||||
|
Loading…
Reference in New Issue
Block a user