]> git.saurik.com Git - wxWidgets.git/blame - src/os2/pen.cpp
Fix another crash when conversion fails in Unix PostScript code.
[wxWidgets.git] / src / os2 / pen.cpp
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
46562151 2// Name: src/os2/pen.cpp
0e320a79 3// Purpose: wxPen
cdf1e714 4// Author: David Webster
0e320a79 5// Modified by:
cdf1e714 6// Created: 10/10/99
cdf1e714 7// Copyright: (c) David Webster
65571936 8// Licence: wxWindows licence
0e320a79
DW
9/////////////////////////////////////////////////////////////////////////////
10
cdf1e714
DW
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
0e320a79 13
f5590243
WS
14#include "wx/pen.h"
15
cdf1e714 16#ifndef WX_PRECOMP
521bf4ff
WS
17 #include <stdio.h>
18 #include "wx/list.h"
19 #include "wx/utils.h"
20 #include "wx/app.h"
521bf4ff 21 #include "wx/log.h"
0e320a79
DW
22#endif
23
cdf1e714 24#include "wx/os2/private.h"
cdf1e714 25
1aca6611
SN
26class WXDLLIMPEXP_FWD_CORE wxPen;
27
28// ----------------------------------------------------------------------------
29// wxPenRefData: contains information about an HPEN and its handle
30// ----------------------------------------------------------------------------
31
32class WXDLLEXPORT wxPenRefData: public wxGDIRefData
33{
34 friend class WXDLLIMPEXP_FWD_CORE wxPen;
35public:
36 wxPenRefData();
37 wxPenRefData(const wxPenRefData& rData);
38 wxPenRefData(const wxColour& col, int width, wxPenStyle style);
39 wxPenRefData(const wxBitmap& stipple, int width);
40 virtual ~wxPenRefData();
41
42 bool operator==(const wxPenRefData& data) const
43 {
44 // we intentionally don't compare m_hPen fields here
45 return m_nStyle == data.m_nStyle &&
46 m_nWidth == data.m_nWidth &&
47 m_nJoin == data.m_nJoin &&
48 m_nCap == data.m_nCap &&
49 m_vColour == data.m_vColour &&
50 (m_nStyle != wxPENSTYLE_STIPPLE || m_vStipple.IsSameAs(data.m_vStipple)) &&
51 (m_nStyle != wxPENSTYLE_USER_DASH ||
52 (m_dash == data.m_dash &&
53 memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0));
54 }
55
56private:
57 // initialize the fields which have reasonable default values
58 //
59 // doesn't initialize m_width and m_style which must be initialize in ctor
60 void Init()
61 {
62 m_nJoin = wxJOIN_ROUND;
63 m_nCap = wxCAP_ROUND;
64 m_nbDash = 0;
65 m_dash = NULL;
66 m_hPen = 0;
67 }
68
69 int m_nWidth;
70 wxPenStyle m_nStyle;
71 wxPenJoin m_nJoin;
72 wxPenCap m_nCap;
73 wxBitmap m_vStipple;
74 int m_nbDash;
75 wxDash * m_dash;
76 wxColour m_vColour;
77 WXHPEN m_hPen;// in OS/2 GPI this will be the PS the pen is associated with
78
c0c133e1 79 wxDECLARE_NO_ASSIGN_CLASS(wxPenRefData);
1aca6611
SN
80};
81
82#define M_PENDATA ((wxPenRefData *)m_refData)
83
84// ----------------------------------------------------------------------------
85// wxPenRefData ctors/dtor
86// ----------------------------------------------------------------------------
004fd0c8 87
0e320a79
DW
88wxPenRefData::wxPenRefData()
89{
1aca6611
SN
90 Init();
91
ed7ec76d 92 m_nStyle = wxPENSTYLE_SOLID;
26ac77db 93 m_nWidth = 1;
26ac77db
DW
94} // end of wxPenRefData::wxPenRefData
95
96wxPenRefData::wxPenRefData(
97 const wxPenRefData& rData
98)
0e320a79 99{
26ac77db
DW
100 m_nStyle = rData.m_nStyle;
101 m_nWidth = rData.m_nWidth;
102 m_nJoin = rData.m_nJoin;
103 m_nCap = rData.m_nCap;
9e878707
SN
104 m_nbDash = rData.m_nbDash;
105 m_dash = rData.m_dash;
26ac77db
DW
106 m_vColour = rData.m_vColour;
107 m_hPen = 0L;
108} // end of wxPenRefData::wxPenRefData
0e320a79 109
1aca6611 110wxPenRefData::wxPenRefData(const wxColour& col, int width, wxPenStyle style)
0e320a79 111{
1aca6611
SN
112 Init();
113
114 m_nStyle = style;
115 m_nWidth = width;
0e320a79 116
1aca6611
SN
117 m_vColour = col;
118}
119
120wxPenRefData::wxPenRefData(const wxBitmap& stipple, int width)
0e320a79 121{
1aca6611
SN
122 Init();
123
124 m_nStyle = wxPENSTYLE_STIPPLE;
125 m_nWidth = width;
126
127 m_vStipple = stipple;
128}
0e320a79 129
1aca6611 130wxPenRefData::~wxPenRefData()
0e320a79 131{
1aca6611
SN
132} // end of wxPenRefData::~wxPenRefData
133
134// ----------------------------------------------------------------------------
135// wxPen
136// ----------------------------------------------------------------------------
137
138IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
0e320a79 139
26ac77db
DW
140wxPen::wxPen(
141 const wxColour& rColour
142, int nWidth
82cddbd9 143, wxPenStyle nStyle
26ac77db 144)
0e320a79 145{
1aca6611 146 m_refData = new wxPenRefData(rColour, nWidth, nStyle);
26ac77db 147
0e320a79 148 RealizeResource();
26ac77db 149} // end of wxPen::wxPen
0e320a79 150
ac3688c0
FM
151#if FUTURE_WXWIN_COMPATIBILITY_3_0
152wxPen::wxPen(const wxColour& colour, int width, int style)
82cddbd9 153{
1aca6611 154 m_refData = new wxPenRefData(colour, width, (wxPenStyle)style);
82cddbd9
FM
155
156 RealizeResource();
157}
ac3688c0 158#endif
82cddbd9 159
26ac77db
DW
160wxPen::wxPen(
161 const wxBitmap& rStipple
162, int nWidth
163)
0e320a79 164{
1aca6611 165 m_refData = new wxPenRefData (rStipple, nWidth);
0e320a79
DW
166
167 RealizeResource();
26ac77db 168} // end of wxPen::wxPen
0e320a79 169
34f00837
SN
170bool wxPen::operator==(const wxPen& pen) const
171{
172 const wxPenRefData *
5c33522f 173 penData = static_cast<const wxPenRefData *>(pen.m_refData);
34f00837
SN
174
175 // an invalid pen is only equal to another invalid pen
176 return m_refData ? penData && *M_PENDATA == *penData : !penData;
177}
178
272ebf16 179int wx2os2PenStyle(
82cddbd9 180 wxPenStyle nWxStyle
272ebf16
SN
181);
182
cdf1e714
DW
183bool wxPen::RealizeResource()
184{
26ac77db
DW
185 BOOL bOk;
186 ERRORID vError;
187 wxString sError;
188
189 if (M_PENDATA && M_PENDATA->m_hPen == 0L)
190 {
191 SIZEL vSize = {0, 0};
192 DEVOPENSTRUC vDop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
193 HDC hDC = ::DevOpenDC( vHabmain
194 ,OD_MEMORY
195 ,"*"
196 ,5L
197 ,(PDEVOPENDATA)&vDop
198 ,NULLHANDLE
199 );
200 M_PENDATA->m_hPen = (WXHPEN)::GpiCreatePS( vHabmain
201 ,hDC
202 ,&vSize
203 ,PU_PELS | GPIT_MICRO | GPIA_ASSOC
204 );
205 }
206 if (M_PENDATA)
207 {
208 //
209 // Set the color table to RGB mode
210 //
211 if (!::GpiCreateLogColorTable( (HPS)M_PENDATA->m_hPen
212 ,0L
213 ,LCOLF_RGB
214 ,0L
215 ,0L
216 ,NULL
217 ))
218 {
219 vError = ::WinGetLastError(vHabmain);
220 sError = wxPMErrorToStr(vError);
9a83f860 221 wxLogError(wxT("Unable to set current color table to RGB mode. Error: %s\n"), sError.c_str());
46562151 222 return false;
26ac77db 223 }
ed7ec76d 224 if (M_PENDATA->m_nStyle == wxPENSTYLE_TRANSPARENT)
26ac77db 225 {
6670f564 226 return true;
26ac77db
DW
227 }
228
6670f564
WS
229 COLORREF vPmColour = 0L;
230 USHORT uLineType = (USHORT)wx2os2PenStyle(M_PENDATA->m_nStyle);
26ac77db
DW
231
232 vPmColour = M_PENDATA->m_vColour.GetPixel();
233
234 USHORT uJoin = 0L;
235
236 switch(M_PENDATA->m_nJoin)
237 {
238 case wxJOIN_BEVEL:
239 uJoin = LINEJOIN_BEVEL;
240 break;
241
242 case wxJOIN_MITER:
243 uJoin = LINEJOIN_MITRE;
244 break;
245
246 case wxJOIN_ROUND:
247 uJoin = LINEJOIN_ROUND;
248 break;
249 }
250
251 USHORT uCap = 0L;
252
253 switch(M_PENDATA->m_nCap)
254 {
255 case wxCAP_PROJECTING:
256 uCap = LINEEND_SQUARE;
257 break;
258
259 case wxCAP_BUTT:
260 uCap = LINEEND_FLAT;
261 break;
262
263 case wxCAP_ROUND:
264 uCap = LINEEND_ROUND;
265 break;
266 }
267 m_vLineBundle.lColor = (LONG)vPmColour;
268 m_vLineBundle.usMixMode = FM_OVERPAINT;
aa2f364e
SN
269 if (M_PENDATA->m_nWidth < 1)
270 M_PENDATA->m_nWidth = 1;
26ac77db
DW
271 m_vLineBundle.fxWidth = M_PENDATA->m_nWidth;
272 m_vLineBundle.lGeomWidth = M_PENDATA->m_nWidth;
273 m_vLineBundle.usType = uLineType;
274 m_vLineBundle.usEnd = uCap;
275 m_vLineBundle.usJoin = uJoin;
276
277 bOk = ::GpiSetAttrs( M_PENDATA->m_hPen
278 ,PRIM_LINE
279 ,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE | LBB_END | LBB_JOIN
280 ,0L
281 ,&m_vLineBundle
282 );
283 if (!bOk)
284 {
285 vError = ::WinGetLastError(vHabmain);
286 sError = wxPMErrorToStr(vError);
9a83f860 287 wxLogError(wxT("Can't set Gpi attributes for a LINEBUNDLE. Error: %s\n"), sError.c_str());
46562151 288 return false;
26ac77db
DW
289 }
290
d697657f
DW
291 ULONG flAttrMask = 0L;
292 ULONG flDefMask = 0L;
26ac77db
DW
293 switch(M_PENDATA->m_nStyle)
294 {
ed7ec76d 295 case wxPENSTYLE_STIPPLE:
26ac77db
DW
296 ::GpiSetBitmapId( M_PENDATA->m_hPen
297 ,(USHORT)M_PENDATA->m_vStipple.GetHBITMAP()
298 ,(USHORT)M_PENDATA->m_vStipple.GetId()
299 );
300 ::GpiSetPatternSet( M_PENDATA->m_hPen
301 ,(USHORT)M_PENDATA->m_vStipple.GetId()
302 );
d697657f
DW
303 flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SET | ABB_SYMBOL;
304 flDefMask = ABB_REF_POINT;
26ac77db
DW
305 break;
306
ed7ec76d 307 case wxPENSTYLE_BDIAGONAL_HATCH:
26ac77db
DW
308 m_vAreaBundle.usSymbol = PATSYM_DIAG3;
309 m_vAreaBundle.usSet = LCID_DEFAULT;
d697657f
DW
310 flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
311 flDefMask = ABB_SET | ABB_REF_POINT;
26ac77db
DW
312 break;
313
ed7ec76d 314 case wxPENSTYLE_CROSSDIAG_HATCH:
26ac77db
DW
315 m_vAreaBundle.usSymbol = PATSYM_DIAGHATCH;
316 m_vAreaBundle.usSet = LCID_DEFAULT;
d697657f
DW
317 flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
318 flDefMask = ABB_SET | ABB_REF_POINT;
26ac77db
DW
319 break;
320
ed7ec76d 321 case wxPENSTYLE_FDIAGONAL_HATCH:
26ac77db
DW
322 m_vAreaBundle.usSymbol = PATSYM_DIAG1;
323 m_vAreaBundle.usSet = LCID_DEFAULT;
d697657f
DW
324 flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
325 flDefMask = ABB_SET | ABB_REF_POINT;
26ac77db
DW
326 break;
327
ed7ec76d 328 case wxPENSTYLE_CROSS_HATCH:
26ac77db
DW
329 m_vAreaBundle.usSymbol = PATSYM_HATCH;
330 m_vAreaBundle.usSet = LCID_DEFAULT;
d697657f
DW
331 flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
332 flDefMask = ABB_SET | ABB_REF_POINT;
26ac77db
DW
333 break;
334
ed7ec76d 335 case wxPENSTYLE_HORIZONTAL_HATCH:
26ac77db
DW
336 m_vAreaBundle.usSymbol = PATSYM_HORIZ;
337 m_vAreaBundle.usSet = LCID_DEFAULT;
d697657f
DW
338 flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
339 flDefMask = ABB_SET | ABB_REF_POINT;
26ac77db
DW
340 break;
341
ed7ec76d 342 case wxPENSTYLE_VERTICAL_HATCH:
26ac77db
DW
343 m_vAreaBundle.usSymbol = PATSYM_VERT;
344 m_vAreaBundle.usSet = LCID_DEFAULT;
d697657f
DW
345 flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
346 flDefMask = ABB_SET | ABB_REF_POINT;
26ac77db
DW
347 break;
348
349 default:
350 m_vAreaBundle.usSymbol = PATSYM_SOLID;
351 m_vAreaBundle.usSet = LCID_DEFAULT;
d697657f
DW
352 flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
353 flDefMask = ABB_SET | ABB_REF_POINT;
26ac77db
DW
354 break;
355 }
356
357 m_vAreaBundle.lColor = vPmColour;
8d854fa9 358 m_vAreaBundle.lBackColor = RGB_WHITE;
26ac77db
DW
359 m_vAreaBundle.usMixMode = FM_OVERPAINT;
360 m_vAreaBundle.usBackMixMode = BM_OVERPAINT;
361
362 bOk = ::GpiSetAttrs( M_PENDATA->m_hPen
363 ,PRIM_AREA
d697657f
DW
364 ,flAttrMask
365 ,flDefMask
26ac77db
DW
366 ,&m_vAreaBundle
367 );
368 if (!bOk)
369 {
370 vError = ::WinGetLastError(vHabmain);
371 sError = wxPMErrorToStr(vError);
9a83f860 372 wxLogError(wxT("Can't set Gpi attributes for an AREABUNDLE. Error: %s\n"), sError.c_str());
26ac77db 373 }
6670f564
WS
374
375 return (bool)bOk;
26ac77db 376 }
6670f564 377 return false;
26ac77db 378} // end of wxPen::RealizeResource
cdf1e714 379
17b1d76b 380WXHANDLE wxPen::GetResourceHandle() const
cdf1e714 381{
26ac77db 382 if (!M_PENDATA)
cdf1e714
DW
383 return 0;
384 else
385 return (WXHANDLE)M_PENDATA->m_hPen;
26ac77db 386} // end of wxPen::GetResourceHandle
cdf1e714 387
6670f564 388bool wxPen::FreeResource( bool WXUNUSED(bForce) )
cdf1e714
DW
389{
390 if (M_PENDATA && (M_PENDATA->m_hPen != 0))
391 {
cdf1e714 392 M_PENDATA->m_hPen = 0;
6670f564 393 return true;
cdf1e714 394 }
6670f564 395 else return false;
26ac77db 396} // end of wxPen::FreeResource
cdf1e714 397
e6ebb514
DW
398bool wxPen::IsFree() const
399{
26ac77db 400 return (M_PENDATA && M_PENDATA->m_hPen == 0);
e6ebb514
DW
401}
402
4b3f61d1 403wxGDIRefData* wxPen::CreateGDIRefData() const
0e320a79 404{
4b3f61d1
SN
405 return new wxPenRefData;
406}
407
408wxGDIRefData* wxPen::CloneGDIRefData(const wxGDIRefData* data) const
409{
5c33522f 410 return new wxPenRefData(*static_cast<const wxPenRefData*>(data));
4b3f61d1 411}
0e320a79 412
46562151 413void wxPen::SetColour( const wxColour& rColour )
0e320a79 414{
4b3f61d1 415 AllocExclusive();
26ac77db 416 M_PENDATA->m_vColour = rColour;
0e320a79 417 RealizeResource();
26ac77db 418} // end of wxPen::SetColour
0e320a79 419
1a1498c0 420void wxPen::SetColour( unsigned char cRed, unsigned char cGreen, unsigned char cBlue)
0e320a79 421{
4b3f61d1 422 AllocExclusive();
26ac77db 423 M_PENDATA->m_vColour.Set(cRed, cGreen, cBlue);
0e320a79 424 RealizeResource();
26ac77db 425} // end of wxPen::SetColour
0e320a79 426
46562151 427void wxPen::SetPS( HPS hPS )
0e320a79 428{
4b3f61d1 429 AllocExclusive();
26ac77db
DW
430 if (M_PENDATA->m_hPen)
431 ::GpiDestroyPS(M_PENDATA->m_hPen);
432 M_PENDATA->m_hPen = hPS;
0e320a79 433 RealizeResource();
26ac77db 434} // end of WxWinGdi_CPen::SetPS
0e320a79 435
26ac77db
DW
436void wxPen::SetWidth(
437 int nWidth
438)
0e320a79 439{
4b3f61d1 440 AllocExclusive();
26ac77db 441 M_PENDATA->m_nWidth = nWidth;
0e320a79 442 RealizeResource();
26ac77db 443} // end of wxPen::SetWidth
0e320a79 444
26ac77db 445void wxPen::SetStyle(
82cddbd9 446 wxPenStyle nStyle
26ac77db 447)
0e320a79 448{
4b3f61d1 449 AllocExclusive();
26ac77db 450 M_PENDATA->m_nStyle = nStyle;
0e320a79 451 RealizeResource();
26ac77db 452} // end of wxPen::SetStyle
0e320a79 453
26ac77db
DW
454void wxPen::SetStipple(
455 const wxBitmap& rStipple
456)
0e320a79 457{
4b3f61d1 458 AllocExclusive();
26ac77db 459 M_PENDATA->m_vStipple = rStipple;
1aca6611 460 M_PENDATA->m_nStyle = wxPENSTYLE_STIPPLE;
0e320a79 461 RealizeResource();
26ac77db 462} // end of wxPen::SetStipple
0e320a79 463
6670f564
WS
464void wxPen::SetDashes( int WXUNUSED(nNbDashes),
465 const wxDash* WXUNUSED(pDash) )
26ac77db
DW
466{
467 //
468 // Does nothing under OS/2
469 //
470} // end of wxPen::SetDashes
471
472void wxPen::SetJoin(
82cddbd9 473 wxPenJoin nJoin
26ac77db 474)
0e320a79 475{
4b3f61d1 476 AllocExclusive();
26ac77db 477 M_PENDATA->m_nJoin = nJoin;
0e320a79 478 RealizeResource();
26ac77db 479} // end of wxPen::SetJoin
0e320a79 480
26ac77db 481void wxPen::SetCap(
82cddbd9 482 wxPenCap nCap
26ac77db 483)
0e320a79 484{
4b3f61d1 485 AllocExclusive();
26ac77db 486 M_PENDATA->m_nCap = nCap;
0e320a79 487 RealizeResource();
26ac77db 488} // end of wxPen::SetCap
0e320a79 489
231b9591 490wxColour wxPen::GetColour() const
1aca6611 491{
a1b806b9 492 wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid pen") );
1aca6611
SN
493
494 return M_PENDATA->m_vColour;
495}
496
497int wxPen::GetWidth() const
498{
a1b806b9 499 wxCHECK_MSG( IsOk(), -1, wxT("invalid pen") );
1aca6611
SN
500
501 return M_PENDATA->m_nWidth;
502}
503
504wxPenStyle wxPen::GetStyle() const
505{
a1b806b9 506 wxCHECK_MSG( IsOk(), wxPENSTYLE_INVALID, wxT("invalid pen") );
1aca6611
SN
507
508 return M_PENDATA->m_nStyle;
509}
510
511wxPenJoin wxPen::GetJoin() const
512{
a1b806b9 513 wxCHECK_MSG( IsOk(), wxJOIN_INVALID, wxT("invalid pen") );
1aca6611
SN
514
515 return M_PENDATA->m_nJoin;
516}
517
518wxPenCap wxPen::GetCap() const
519{
a1b806b9 520 wxCHECK_MSG( IsOk(), wxCAP_INVALID, wxT("invalid pen") );
1aca6611
SN
521
522 return M_PENDATA->m_nCap;
523}
524
525int wxPen::GetPS() const
526{
a1b806b9 527 wxCHECK_MSG( IsOk(), 0, wxT("invalid pen") );
1aca6611
SN
528
529 return M_PENDATA->m_hPen;
530}
531
532int wxPen::GetDashes(wxDash** ptr) const
533{
a1b806b9 534 wxCHECK_MSG( IsOk(), -1, wxT("invalid pen") );
1aca6611
SN
535
536 *ptr = M_PENDATA->m_dash;
537 return M_PENDATA->m_nbDash;
538}
539
540wxDash* wxPen::GetDash() const
541{
a1b806b9 542 wxCHECK_MSG( IsOk(), NULL, wxT("invalid pen") );
1aca6611
SN
543
544 return M_PENDATA->m_dash;
545}
546
547int wxPen::GetDashCount() const
548{
a1b806b9 549 wxCHECK_MSG( IsOk(), -1, wxT("invalid pen") );
1aca6611
SN
550
551 return M_PENDATA->m_nbDash;
552}
553
554wxBitmap* wxPen::GetStipple() const
555{
a1b806b9 556 wxCHECK_MSG( IsOk(), NULL, wxT("invalid pen") );
1aca6611
SN
557
558 return &(M_PENDATA->m_vStipple);
559}
560
26ac77db 561int wx2os2PenStyle(
82cddbd9 562 wxPenStyle nWxStyle
26ac77db 563)
cdf1e714 564{
26ac77db
DW
565 int nPMStyle = 0;
566
567 switch (nWxStyle)
fb46a9a6 568 {
ed7ec76d 569 case wxPENSTYLE_DOT:
26ac77db
DW
570 nPMStyle = LINETYPE_DOT;
571 break;
572
ed7ec76d 573 case wxPENSTYLE_DOT_DASH:
26ac77db
DW
574 nPMStyle = LINETYPE_DASHDOT;
575 break;
576
ed7ec76d 577 case wxPENSTYLE_SHORT_DASH:
26ac77db
DW
578 nPMStyle = LINETYPE_SHORTDASH;
579 break;
580
ed7ec76d 581 case wxPENSTYLE_LONG_DASH:
26ac77db
DW
582 nPMStyle = LINETYPE_LONGDASH;
583 break;
584
ed7ec76d 585 case wxPENSTYLE_TRANSPARENT:
26ac77db
DW
586 nPMStyle = LINETYPE_INVISIBLE;
587 break;
588
ed7ec76d 589 case wxPENSTYLE_USER_DASH:
26ac77db
DW
590 nPMStyle = LINETYPE_DASHDOUBLEDOT; // We must make a choice... This is mine!
591 break;
592
ed7ec76d 593 case wxPENSTYLE_SOLID:
26ac77db
DW
594 default:
595 nPMStyle = LINETYPE_SOLID;
596 break;
597 }
598 return nPMStyle;
599} // end of wx2os2PenStyle