]> git.saurik.com Git - wxWidgets.git/blame - src/common/dcbase.cpp
msg boxes now have icons
[wxWidgets.git] / src / common / dcbase.cpp
CommitLineData
dbe94982
BM
1/////////////////////////////////////////////////////////////////////////////
2// Name: dc.cpp
3// Purpose: wxDC Class
4// Author: Brian Macy
5// Modified by:
6// Created: 05/25/99
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "dcbase.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#ifndef WX_PRECOMP
0c589ad0 24 #include "wx/window.h"
dbf3cd7a 25#ifdef __WXMSW__
0c589ad0 26 #include "wx/msw/private.h"
dbe94982 27#endif
dbf3cd7a 28#endif
dbe94982
BM
29
30#include "wx/dc.h"
31
32void wxDCBase::DrawLines(const wxList *list, long xoffset, long yoffset)
33{
34 int n = list->Number();
35 wxPoint *points = new wxPoint[n];
36
37 int i = 0;
38 for ( wxNode *node = list->First(); node; node = node->Next(), i++ )
39 {
40 wxPoint *point = (wxPoint *)node->Data();
41 points[i].x = point->x;
42 points[i].y = point->y;
43 }
44
45 DoDrawLines(n, points, xoffset, yoffset);
46
47 delete [] points;
48}
49
50
51void wxDCBase::DrawPolygon(const wxList *list,
52 long xoffset, long yoffset,
53 int fillStyle)
54{
55 int n = list->Number();
56 wxPoint *points = new wxPoint[n];
57
58 int i = 0;
59 for ( wxNode *node = list->First(); node; node = node->Next(), i++ )
60 {
61 wxPoint *point = (wxPoint *)node->Data();
62 points[i].x = point->x;
63 points[i].y = point->y;
64 }
65
66 DoDrawPolygon(n, points, xoffset, yoffset, fillStyle);
67
68 delete [] points;
69}
70
71
88ac883a 72#if wxUSE_SPLINES
dbe94982
BM
73
74// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
75void wxDCBase::DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3)
76{
77 wxList point_list;
78
79 wxPoint *point1 = new wxPoint;
80 point1->x = x1; point1->y = y1;
81 point_list.Append((wxObject*)point1);
82
83 wxPoint *point2 = new wxPoint;
84 point2->x = x2; point2->y = y2;
85 point_list.Append((wxObject*)point2);
86
87 wxPoint *point3 = new wxPoint;
88 point3->x = x3; point3->y = y3;
89 point_list.Append((wxObject*)point3);
90
91 DrawSpline(&point_list);
92
93 for( wxNode *node = point_list.First(); node; node = node->Next() )
94 {
95 wxPoint *p = (wxPoint *)node->Data();
96 delete p;
97 }
98}
99
100void wxDCBase::DrawSpline(int n, wxPoint points[])
101{
102 wxList list;
103 for (int i =0; i < n; i++)
104 {
105 list.Append((wxObject*)&points[i]);
106 }
107
108 DrawSpline(&list);
109}
110
88ac883a 111#endif // wxUSE_SPLINES