X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0b7dce5480b8cf7ce4368122744d853f7a684e34..cdb7bf66716a4f5c5d0e8b203e52826defdf5906:/src/generic/graphicc.cpp diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index 6780545914..6b29c3a902 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -165,7 +165,7 @@ public : // gets the bounding box enclosing all points (possibly including control points) virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const; - virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxWINDING_RULE) const; + virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxWINDING_RULE) const; private : cairo_t* m_pathContext; @@ -291,9 +291,11 @@ public: virtual void Apply( wxGraphicsContext* context ); #ifdef __WXGTK__ const PangoFontDescription* GetFont() const { return m_font; } + bool GetUnderlined() const { return m_underlined; } #endif private : double m_size; + bool m_underlined; double m_red; double m_green; double m_blue; @@ -345,10 +347,10 @@ public: virtual void * GetNativeContext(); - virtual bool SetLogicalFunction( int function ); + virtual bool SetLogicalFunction( wxRasterOperationMode function ); virtual void StrokePath( const wxGraphicsPath& p ); - virtual void FillPath( const wxGraphicsPath& p , int fillStyle = wxWINDING_RULE ); + virtual void FillPath( const wxGraphicsPath& p , wxPolygonFillMode fillStyle = wxWINDING_RULE ); virtual void Translate( wxDouble dx , wxDouble dy ); virtual void Scale( wxDouble xScale , wxDouble yScale ); @@ -532,7 +534,7 @@ wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen ) } break; default : - if ( m_pen.GetStyle() >= wxPENSTYLE_FIRST_HATCH + if ( m_pen.GetStyle() >= wxPENSTYLE_FIRST_HATCH && m_pen.GetStyle() <= wxPENSTYLE_LAST_HATCH ) { /* @@ -703,6 +705,7 @@ wxCairoFontData::wxCairoFontData( wxGraphicsRenderer* renderer, const wxFont &fo m_blue = col.Blue()/255.0; m_alpha = col.Alpha()/255.0; m_size = font.GetPointSize(); + m_underlined = font.GetUnderlined(); #ifdef __WXMAC__ m_font = cairo_atsui_font_face_create_for_atsu_font_id( font.MacGetATSUFontID() ); @@ -879,7 +882,7 @@ void wxCairoPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) } } -bool wxCairoPathData::Contains( wxDouble x, wxDouble y, int WXUNUSED(fillStyle) ) const +bool wxCairoPathData::Contains( wxDouble x, wxDouble y, wxPolygonFillMode WXUNUSED(fillStyle) ) const { return cairo_in_stroke( m_pathContext, x, y) != 0; } @@ -1223,7 +1226,7 @@ void wxCairoContext::StrokePath( const wxGraphicsPath& path ) } } -void wxCairoContext::FillPath( const wxGraphicsPath& path , int fillStyle ) +void wxCairoContext::FillPath( const wxGraphicsPath& path , wxPolygonFillMode fillStyle ) { if ( !m_brush.IsNull() ) { @@ -1409,8 +1412,19 @@ void wxCairoContext::DoDrawText(const wxString& str, wxDouble x, wxDouble y) size_t datalen = strlen(data); PangoLayout *layout = pango_cairo_create_layout (m_context); - pango_layout_set_font_description( layout, ((wxCairoFontData*)m_font.GetRefData())->GetFont()); + wxCairoFontData* font_data = (wxCairoFontData*) m_font.GetRefData(); + pango_layout_set_font_description( layout, font_data->GetFont()); pango_layout_set_text(layout, data, datalen); + + if (font_data->GetUnderlined()) + { + PangoAttrList *attrs = pango_attr_list_new(); + PangoAttribute *attr = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); + pango_attr_list_insert(attrs, attr); + pango_layout_set_attributes(layout, attrs); + pango_attr_list_unref(attrs); + } + cairo_move_to(m_context, x, y); pango_cairo_show_layout (m_context, layout); @@ -1525,7 +1539,7 @@ void * wxCairoContext::GetNativeContext() // Cairo doesn't support bitwise logical function (a.k.a. ROP, raster output // mode). Cairo supports Porter-Duff compositing operators, but they are quite // different, although in some cases have similar names. -bool wxCairoContext::SetLogicalFunction( int function ) +bool wxCairoContext::SetLogicalFunction( wxRasterOperationMode function ) { if (m_logicalFunction == function) return true;