/////////////////////////////////////////////////////////////////////////////
-// Name: msw/pen.cpp
+// Name: src/msw/pen.cpp
// Purpose: wxPen
// Author: Julian Smart
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "pen.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
-#ifndef WX_PRECOMP
-#include <stdio.h>
-#include "wx/setup.h"
-#include "wx/list.h"
-#include "wx/utils.h"
-#include "wx/app.h"
#include "wx/pen.h"
+
+#ifndef WX_PRECOMP
+ #include <stdio.h>
+ #include "wx/list.h"
+ #include "wx/utils.h"
+ #include "wx/app.h"
#endif
#include "wx/msw/private.h"
// Join style, Cap style, Pen Stippling
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
// Only NT can display dashed or dotted lines with width > 1
- if ( os != wxWINDOWS_NT &&
- (M_PENDATA->m_style & (wxDOT |
- wxLONG_DASH |
- wxSHORT_DASH |
- wxDOT_DASH |
- wxUSER_DASH)) &&
+ if ( os != wxOS_WINDOWS_NT &&
+ (M_PENDATA->m_style == wxDOT ||
+ M_PENDATA->m_style == wxLONG_DASH ||
+ M_PENDATA->m_style == wxSHORT_DASH ||
+ M_PENDATA->m_style == wxDOT_DASH ||
+ M_PENDATA->m_style == wxUSER_DASH) &&
M_PENDATA->m_width > 1 )
{
M_PENDATA->m_width = 1;
real_dash = (wxMSWDash*)NULL;
}
- // Win32s doesn't have ExtCreatePen function...
- if (os==wxWINDOWS_NT || os==wxWIN95)
- {
- M_PENDATA->m_hPen =
- (WXHPEN) ExtCreatePen( ms_style,
- M_PENDATA->m_width,
- &logb,
- M_PENDATA->m_style == wxUSER_DASH
- ? M_PENDATA->m_nbDash
- : 0,
- (LPDWORD)real_dash );
- }
- else
- {
- M_PENDATA->m_hPen =
- (WXHPEN) CreatePen( wx2msPenStyle(M_PENDATA->m_style),
- M_PENDATA->m_width,
- ms_colour );
- }
+ M_PENDATA->m_hPen =
+ (WXHPEN) ExtCreatePen( ms_style,
+ M_PENDATA->m_width,
+ &logb,
+ M_PENDATA->m_style == wxUSER_DASH
+ ? M_PENDATA->m_nbDash
+ : 0,
+ (LPDWORD)real_dash );
delete [] real_dash;
}
WXHANDLE wxPen::GetResourceHandle() const
{
- if ( !M_PENDATA )
- return 0;
- else
- return (WXHANDLE)M_PENDATA->m_hPen;
+ if ( !M_PENDATA )
+ return 0;
+ else
+ return (WXHANDLE)M_PENDATA->m_hPen;
}
bool wxPen::FreeResource(bool WXUNUSED(force))
{
- if (M_PENDATA && (M_PENDATA->m_hPen != 0))
- {
- DeleteObject((HPEN) M_PENDATA->m_hPen);
- M_PENDATA->m_hPen = 0;
- return true;
- }
- else return false;
+ if (M_PENDATA && (M_PENDATA->m_hPen != 0))
+ {
+ DeleteObject((HPEN) M_PENDATA->m_hPen);
+ M_PENDATA->m_hPen = 0;
+ return true;
+ }
+ else return false;
}
bool wxPen::IsFree() const
{
- return (M_PENDATA && M_PENDATA->m_hPen == 0);
+ return (M_PENDATA && M_PENDATA->m_hPen == 0);
}
void wxPen::Unshare()
{
- // Don't change shared data
- if (!m_refData)
+ // Don't change shared data
+ if (!m_refData)
{
- m_refData = new wxPenRefData();
- }
+ m_refData = new wxPenRefData();
+ }
else
{
- wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
- UnRef();
- m_refData = ref;
- }
+ wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
+ UnRef();
+ m_refData = ref;
+ }
}
void wxPen::SetColour(const wxColour& col)
return PS_NULL;
case wxUSER_DASH:
- // if (wxGetOsVersion()==wxWINDOWS_NT || wxGetOsVersion()==wxWIN95)
- return PS_USERSTYLE;
+ return PS_USERSTYLE;
}
#else
wxUnusedVar(wx_style);
#endif
return PS_SOLID;
}
-