Apply minimal DC patch.
Implement GetDepth for GTK2. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34216 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1744,11 +1744,8 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
#else
|
||||
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
|
||||
if ( !wdata )
|
||||
{
|
||||
if (width) (*width) = 0;
|
||||
if (height) (*height) = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
||||
const char *dataUTF8 = (const char *)data;
|
||||
#endif
|
||||
@@ -1761,19 +1758,21 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
|
||||
pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) );
|
||||
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||
|
||||
if (width)
|
||||
*width = (wxCoord) w;
|
||||
if (height)
|
||||
*height = (wxCoord) h;
|
||||
if (descent)
|
||||
{
|
||||
int h;
|
||||
pango_layout_get_pixel_size( m_layout, width, &h );
|
||||
PangoLayoutIter *iter = pango_layout_get_iter(m_layout);
|
||||
int baseline = pango_layout_iter_get_baseline(iter);
|
||||
pango_layout_iter_free(iter);
|
||||
*descent = h - PANGO_PIXELS(baseline);
|
||||
|
||||
if (height)
|
||||
*height = (wxCoord) h;
|
||||
}
|
||||
else
|
||||
{
|
||||
pango_layout_get_pixel_size( m_layout, width, height );
|
||||
}
|
||||
|
||||
// Reset old font description
|
||||
@@ -1801,8 +1800,8 @@ wxCoord wxWindowDC::GetCharWidth() const
|
||||
{
|
||||
#ifdef __WXGTK20__
|
||||
pango_layout_set_text( m_layout, "H", 1 );
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||
int w;
|
||||
pango_layout_get_pixel_size( m_layout, &w, NULL );
|
||||
return w;
|
||||
#else
|
||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||
@@ -1816,8 +1815,8 @@ wxCoord wxWindowDC::GetCharHeight() const
|
||||
{
|
||||
#ifdef __WXGTK20__
|
||||
pango_layout_set_text( m_layout, "H", 1 );
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||
int h;
|
||||
pango_layout_get_pixel_size( m_layout, NULL, &h );
|
||||
return h;
|
||||
#else
|
||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||
@@ -2003,7 +2002,6 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
}
|
||||
}
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0) || (GTK_MAJOR_VERSION > 1)
|
||||
if (req_dash && req_nb_dash)
|
||||
{
|
||||
wxGTKDash *real_req_dash = new wxGTKDash[req_nb_dash];
|
||||
@@ -2020,7 +2018,6 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
gdk_gc_set_dashes( m_penGC, 0, (wxGTKDash*)req_dash, req_nb_dash );
|
||||
}
|
||||
}
|
||||
#endif // GTK+ > 1.0
|
||||
|
||||
GdkCapStyle capStyle = GDK_CAP_ROUND;
|
||||
switch (m_pen.GetCap())
|
||||
@@ -2164,7 +2161,6 @@ void wxWindowDC::SetLogicalFunction( int function )
|
||||
{
|
||||
case wxXOR: mode = GDK_XOR; break;
|
||||
case wxINVERT: mode = GDK_INVERT; break;
|
||||
#if (GTK_MINOR_VERSION > 0) || (GTK_MAJOR_VERSION > 1)
|
||||
case wxOR_REVERSE: mode = GDK_OR_REVERSE; break;
|
||||
case wxAND_REVERSE: mode = GDK_AND_REVERSE; break;
|
||||
case wxCLEAR: mode = GDK_CLEAR; break;
|
||||
@@ -2181,7 +2177,6 @@ void wxWindowDC::SetLogicalFunction( int function )
|
||||
|
||||
// unsupported by GTK
|
||||
case wxNOR: mode = GDK_COPY; break;
|
||||
#endif // GTK+ > 1.0
|
||||
default:
|
||||
wxFAIL_MSG( wxT("unsupported logical function") );
|
||||
mode = GDK_COPY;
|
||||
@@ -2392,9 +2387,13 @@ wxSize wxWindowDC::GetPPI() const
|
||||
|
||||
int wxWindowDC::GetDepth() const
|
||||
{
|
||||
#ifdef __WXGTK20__
|
||||
return gdk_drawable_get_depth(m_window);
|
||||
#else
|
||||
wxFAIL_MSG(wxT("not implemented"));
|
||||
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1744,11 +1744,8 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
#else
|
||||
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
|
||||
if ( !wdata )
|
||||
{
|
||||
if (width) (*width) = 0;
|
||||
if (height) (*height) = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
||||
const char *dataUTF8 = (const char *)data;
|
||||
#endif
|
||||
@@ -1761,19 +1758,21 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
|
||||
pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) );
|
||||
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||
|
||||
if (width)
|
||||
*width = (wxCoord) w;
|
||||
if (height)
|
||||
*height = (wxCoord) h;
|
||||
if (descent)
|
||||
{
|
||||
int h;
|
||||
pango_layout_get_pixel_size( m_layout, width, &h );
|
||||
PangoLayoutIter *iter = pango_layout_get_iter(m_layout);
|
||||
int baseline = pango_layout_iter_get_baseline(iter);
|
||||
pango_layout_iter_free(iter);
|
||||
*descent = h - PANGO_PIXELS(baseline);
|
||||
|
||||
if (height)
|
||||
*height = (wxCoord) h;
|
||||
}
|
||||
else
|
||||
{
|
||||
pango_layout_get_pixel_size( m_layout, width, height );
|
||||
}
|
||||
|
||||
// Reset old font description
|
||||
@@ -1801,8 +1800,8 @@ wxCoord wxWindowDC::GetCharWidth() const
|
||||
{
|
||||
#ifdef __WXGTK20__
|
||||
pango_layout_set_text( m_layout, "H", 1 );
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||
int w;
|
||||
pango_layout_get_pixel_size( m_layout, &w, NULL );
|
||||
return w;
|
||||
#else
|
||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||
@@ -1816,8 +1815,8 @@ wxCoord wxWindowDC::GetCharHeight() const
|
||||
{
|
||||
#ifdef __WXGTK20__
|
||||
pango_layout_set_text( m_layout, "H", 1 );
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||
int h;
|
||||
pango_layout_get_pixel_size( m_layout, NULL, &h );
|
||||
return h;
|
||||
#else
|
||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||
@@ -2003,7 +2002,6 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
}
|
||||
}
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0) || (GTK_MAJOR_VERSION > 1)
|
||||
if (req_dash && req_nb_dash)
|
||||
{
|
||||
wxGTKDash *real_req_dash = new wxGTKDash[req_nb_dash];
|
||||
@@ -2020,7 +2018,6 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
gdk_gc_set_dashes( m_penGC, 0, (wxGTKDash*)req_dash, req_nb_dash );
|
||||
}
|
||||
}
|
||||
#endif // GTK+ > 1.0
|
||||
|
||||
GdkCapStyle capStyle = GDK_CAP_ROUND;
|
||||
switch (m_pen.GetCap())
|
||||
@@ -2164,7 +2161,6 @@ void wxWindowDC::SetLogicalFunction( int function )
|
||||
{
|
||||
case wxXOR: mode = GDK_XOR; break;
|
||||
case wxINVERT: mode = GDK_INVERT; break;
|
||||
#if (GTK_MINOR_VERSION > 0) || (GTK_MAJOR_VERSION > 1)
|
||||
case wxOR_REVERSE: mode = GDK_OR_REVERSE; break;
|
||||
case wxAND_REVERSE: mode = GDK_AND_REVERSE; break;
|
||||
case wxCLEAR: mode = GDK_CLEAR; break;
|
||||
@@ -2181,7 +2177,6 @@ void wxWindowDC::SetLogicalFunction( int function )
|
||||
|
||||
// unsupported by GTK
|
||||
case wxNOR: mode = GDK_COPY; break;
|
||||
#endif // GTK+ > 1.0
|
||||
default:
|
||||
wxFAIL_MSG( wxT("unsupported logical function") );
|
||||
mode = GDK_COPY;
|
||||
@@ -2392,9 +2387,13 @@ wxSize wxWindowDC::GetPPI() const
|
||||
|
||||
int wxWindowDC::GetDepth() const
|
||||
{
|
||||
#ifdef __WXGTK20__
|
||||
return gdk_drawable_get_depth(m_window);
|
||||
#else
|
||||
wxFAIL_MSG(wxT("not implemented"));
|
||||
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user