X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8b0975a38e83e3a5a3874c4526bc0cee279305be..137c8bde085d6d5b7c459902d2ea1a198ab48765:/src/msw/pen.cpp?ds=sidebyside diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index 93776357d4..745caf55b0 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: msw/pen.cpp +// Name: src/msw/pen.cpp // Purpose: wxPen // Author: Julian Smart // Modified by: @@ -9,24 +9,20 @@ // 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 -#include "wx/setup.h" -#include "wx/list.h" -#include "wx/utils.h" -#include "wx/app.h" #include "wx/pen.h" + +#ifndef WX_PRECOMP + #include + #include "wx/list.h" + #include "wx/utils.h" + #include "wx/app.h" #endif #include "wx/msw/private.h" @@ -47,6 +43,7 @@ wxPenRefData::wxPenRefData() } wxPenRefData::wxPenRefData(const wxPenRefData& data) + :wxGDIRefData() { m_style = data.m_style; m_width = data.m_width; @@ -127,11 +124,11 @@ bool wxPen::RealizeResource() #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)) && + (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; @@ -262,41 +259,41 @@ bool wxPen::RealizeResource() 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) @@ -400,4 +397,3 @@ int wx2msPenStyle(int wx_style) #endif return PS_SOLID; } -