]>
git.saurik.com Git - wxWidgets.git/blob - src/common/dcbase.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "dcbase.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
24 #include "wx/window.h"
28 #include "wx/msw/private.h"
33 void wxDCBase::DoDrawCheckMark(wxCoord x1
, wxCoord y1
,
34 wxCoord width
, wxCoord height
)
36 wxCHECK_RET( Ok(), wxT("invalid window dc") );
38 wxCoord x2
= x1
+ width
,
41 // this is to yield width of 3 for width == height == 10
42 SetPen(wxPen(GetTextForeground(), (width
+ height
+ 1) / 7, wxSOLID
));
44 // we're drawing a scaled version of wx/generic/tick.xpm here
45 wxCoord x3
= x1
+ (4*width
) / 10, // x of the tick bottom
46 y3
= y1
+ height
/ 2; // y of the left tick branch
47 DoDrawLine(x1
, y3
, x3
, y2
);
48 DoDrawLine(x3
, y2
, x2
, y1
);
50 CalcBoundingBox(x1
, y1
);
51 CalcBoundingBox(x2
, y2
);
54 void wxDCBase::DrawLines(const wxList
*list
, wxCoord xoffset
, wxCoord yoffset
)
56 int n
= list
->Number();
57 wxPoint
*points
= new wxPoint
[n
];
60 for ( wxNode
*node
= list
->First(); node
; node
= node
->Next(), i
++ )
62 wxPoint
*point
= (wxPoint
*)node
->Data();
63 points
[i
].x
= point
->x
;
64 points
[i
].y
= point
->y
;
67 DoDrawLines(n
, points
, xoffset
, yoffset
);
73 void wxDCBase::DrawPolygon(const wxList
*list
,
74 wxCoord xoffset
, wxCoord yoffset
,
77 int n
= list
->Number();
78 wxPoint
*points
= new wxPoint
[n
];
81 for ( wxNode
*node
= list
->First(); node
; node
= node
->Next(), i
++ )
83 wxPoint
*point
= (wxPoint
*)node
->Data();
84 points
[i
].x
= point
->x
;
85 points
[i
].y
= point
->y
;
88 DoDrawPolygon(n
, points
, xoffset
, yoffset
, fillStyle
);
96 // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
97 void wxDCBase::DrawSpline(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
, wxCoord x3
, wxCoord y3
)
101 wxPoint
*point1
= new wxPoint
;
102 point1
->x
= x1
; point1
->y
= y1
;
103 point_list
.Append((wxObject
*)point1
);
105 wxPoint
*point2
= new wxPoint
;
106 point2
->x
= x2
; point2
->y
= y2
;
107 point_list
.Append((wxObject
*)point2
);
109 wxPoint
*point3
= new wxPoint
;
110 point3
->x
= x3
; point3
->y
= y3
;
111 point_list
.Append((wxObject
*)point3
);
113 DrawSpline(&point_list
);
115 for( wxNode
*node
= point_list
.First(); node
; node
= node
->Next() )
117 wxPoint
*p
= (wxPoint
*)node
->Data();
122 void wxDCBase::DrawSpline(int n
, wxPoint points
[])
125 for (int i
=0; i
< n
; i
++)
127 list
.Append((wxObject
*)&points
[i
]);
133 #endif // wxUSE_SPLINES