wxGTK1 : change type of wxMask.GetBitmap() from GdkBitmap* to wxBitmap
This commit is contained in:
		@@ -49,8 +49,10 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // implementation
 | 
					    // implementation
 | 
				
			||||||
    GdkBitmap   *m_bitmap;
 | 
					    GdkBitmap   *m_bitmap;
 | 
				
			||||||
 | 
					    int m_width;
 | 
				
			||||||
 | 
					    int m_height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GdkBitmap *GetBitmap() const;
 | 
					    wxBitmap GetBitmap() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    wxDECLARE_DYNAMIC_CLASS(wxMask);
 | 
					    wxDECLARE_DYNAMIC_CLASS(wxMask);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -172,6 +172,9 @@ bool wxMask::Create( const wxBitmap& bitmap,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    gdk_gc_unref( gc );
 | 
					    gdk_gc_unref( gc );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_width = bitmap.GetWidth();
 | 
				
			||||||
 | 
					    m_height = bitmap.GetHeight();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -211,12 +214,24 @@ bool wxMask::Create( const wxBitmap& bitmap )
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    gdk_gc_unref( gc );
 | 
					    gdk_gc_unref( gc );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_width = bitmap.GetWidth();
 | 
				
			||||||
 | 
					    m_height = bitmap.GetHeight();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GdkBitmap *wxMask::GetBitmap() const
 | 
					wxBitmap wxMask::GetBitmap() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_bitmap;
 | 
					   wxBitmap bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   if (m_bitmap)
 | 
				
			||||||
 | 
					     {
 | 
				
			||||||
 | 
						bitmap.SetBitmap( m_bitmap );
 | 
				
			||||||
 | 
						bitmap.SetWidth( m_width );
 | 
				
			||||||
 | 
						bitmap.SetHeight( m_height );
 | 
				
			||||||
 | 
					     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   return bitmap;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -534,7 +549,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
 | 
				
			|||||||
        if (width % 8 != 0)
 | 
					        if (width % 8 != 0)
 | 
				
			||||||
            dstbyteperline++;
 | 
					            dstbyteperline++;
 | 
				
			||||||
        dst = (char*) malloc(dstbyteperline*height);
 | 
					        dst = (char*) malloc(dstbyteperline*height);
 | 
				
			||||||
        img = gdk_image_get( GetMask()->GetBitmap(), 0, 0, GetWidth(), GetHeight() );
 | 
					        img = gdk_image_get( GetMask()->m_bitmap, 0, 0, GetWidth(), GetHeight() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (int h = 0; h < height; h++)
 | 
					        for (int h = 0; h < height; h++)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -698,9 +713,9 @@ bool wxBitmap::CreateFromImageAsBitmap(const wxImage& img)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (image.HasMask())
 | 
					    if (image.HasMask())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        GdkGC *mask_gc = gdk_gc_new( GetMask()->GetBitmap() );
 | 
					        GdkGC *mask_gc = gdk_gc_new( GetMask()->m_bitmap );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
 | 
					        gdk_draw_image( GetMask()->m_bitmap, mask_gc, mask_image, 0, 0, 0, 0, width, height );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gdk_image_destroy( mask_image );
 | 
					        gdk_image_destroy( mask_image );
 | 
				
			||||||
        gdk_gc_unref( mask_gc );
 | 
					        gdk_gc_unref( mask_gc );
 | 
				
			||||||
@@ -938,9 +953,9 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (image.HasMask())
 | 
					    if (image.HasMask())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        GdkGC *mask_gc = gdk_gc_new( GetMask()->GetBitmap() );
 | 
					        GdkGC *mask_gc = gdk_gc_new( GetMask()->m_bitmap );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
 | 
					        gdk_draw_image( GetMask()->m_bitmap, mask_gc, mask_image, 0, 0, 0, 0, width, height );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gdk_image_destroy( mask_image );
 | 
					        gdk_image_destroy( mask_image );
 | 
				
			||||||
        gdk_gc_unref( mask_gc );
 | 
					        gdk_gc_unref( mask_gc );
 | 
				
			||||||
@@ -995,7 +1010,7 @@ wxImage wxBitmap::ConvertToImage() const
 | 
				
			|||||||
    GdkImage *gdk_image_mask = NULL;
 | 
					    GdkImage *gdk_image_mask = NULL;
 | 
				
			||||||
    if (GetMask())
 | 
					    if (GetMask())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        gdk_image_mask = gdk_image_get( GetMask()->GetBitmap(),
 | 
					        gdk_image_mask = gdk_image_get( GetMask()->m_bitmap,
 | 
				
			||||||
                                        0, 0,
 | 
					                                        0, 0,
 | 
				
			||||||
                                        GetWidth(), GetHeight() );
 | 
					                                        GetWidth(), GetHeight() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -206,7 +206,7 @@ void wxBitmapButton::OnSetBitmap()
 | 
				
			|||||||
     }
 | 
					     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GdkBitmap *mask = NULL;
 | 
					    GdkBitmap *mask = NULL;
 | 
				
			||||||
    if (the_one.GetMask()) mask = the_one.GetMask()->GetBitmap();
 | 
					    if (the_one.GetMask()) mask = the_one.GetMask()->m_bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GtkWidget *child = BUTTON_CHILD(m_widget);
 | 
					    GtkWidget *child = BUTTON_CHILD(m_widget);
 | 
				
			||||||
    if (child == NULL)
 | 
					    if (child == NULL)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1042,7 +1042,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // apply mask if any
 | 
					    // apply mask if any
 | 
				
			||||||
    GdkBitmap *mask = NULL;
 | 
					    GdkBitmap *mask = NULL;
 | 
				
			||||||
    if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap();
 | 
					    if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->m_bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GdkBitmap *new_mask = NULL;
 | 
					    GdkBitmap *new_mask = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1265,7 +1265,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // apply mask if any
 | 
					        // apply mask if any
 | 
				
			||||||
        GdkBitmap *mask = NULL;
 | 
					        GdkBitmap *mask = NULL;
 | 
				
			||||||
        if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap();
 | 
					        if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->m_bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        GdkBitmap *new_mask = NULL;
 | 
					        GdkBitmap *new_mask = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1823,7 +1823,7 @@ void wxWindowDCImpl::SetBrush( const wxBrush &brush )
 | 
				
			|||||||
    if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
 | 
					    if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        gdk_gc_set_fill( m_textGC, GDK_OPAQUE_STIPPLED);
 | 
					        gdk_gc_set_fill( m_textGC, GDK_OPAQUE_STIPPLED);
 | 
				
			||||||
        gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->GetBitmap() );
 | 
					        gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->m_bitmap );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (m_brush.IsHatch())
 | 
					    if (m_brush.IsHatch())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -801,7 +801,7 @@ void wxDropSource::PrepareIcon( int action, GdkDragContext *context )
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    GdkBitmap *mask;
 | 
					    GdkBitmap *mask;
 | 
				
			||||||
    if ( icon->GetMask() )
 | 
					    if ( icon->GetMask() )
 | 
				
			||||||
        mask = icon->GetMask()->GetBitmap();
 | 
					        mask = icon->GetMask()->m_bitmap;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        mask = NULL;
 | 
					        mask = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -517,7 +517,7 @@ bool wxNotebook::SetPageImage( size_t page, int image )
 | 
				
			|||||||
    GdkBitmap *mask = NULL;
 | 
					    GdkBitmap *mask = NULL;
 | 
				
			||||||
    if ( bmp.GetMask() )
 | 
					    if ( bmp.GetMask() )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        mask = bmp.GetMask()->GetBitmap();
 | 
					        mask = bmp.GetMask()->m_bitmap;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pixmapwid == NULL)
 | 
					    if (pixmapwid == NULL)
 | 
				
			||||||
@@ -684,7 +684,7 @@ bool wxNotebook::InsertPage( size_t position,
 | 
				
			|||||||
        GdkBitmap *mask = NULL;
 | 
					        GdkBitmap *mask = NULL;
 | 
				
			||||||
        if ( bmp.GetMask() )
 | 
					        if ( bmp.GetMask() )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            mask = bmp.GetMask()->GetBitmap();
 | 
					            mask = bmp.GetMask()->m_bitmap;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );
 | 
					        GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,7 +73,7 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        GdkBitmap *mask = NULL;
 | 
					        GdkBitmap *mask = NULL;
 | 
				
			||||||
        if (m_bitmap.GetMask())
 | 
					        if (m_bitmap.GetMask())
 | 
				
			||||||
            mask = m_bitmap.GetMask()->GetBitmap();
 | 
					            mask = m_bitmap.GetMask()->m_bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gtk_pixmap_set(GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask);
 | 
					        gtk_pixmap_set(GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -136,7 +136,7 @@ void wxToggleBitmapButton::OnSetBitmap()
 | 
				
			|||||||
    if (!m_bitmap.IsOk()) return;
 | 
					    if (!m_bitmap.IsOk()) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GdkBitmap *mask = NULL;
 | 
					    GdkBitmap *mask = NULL;
 | 
				
			||||||
    if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
 | 
					    if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->m_bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GtkWidget *child = BUTTON_CHILD(m_widget);
 | 
					    GtkWidget *child = BUTTON_CHILD(m_widget);
 | 
				
			||||||
    if (child == NULL)
 | 
					    if (child == NULL)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,7 +123,7 @@ public:
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        if (bitmap.IsOk())
 | 
					        if (bitmap.IsOk())
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap()
 | 
					            GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->m_bitmap
 | 
				
			||||||
                                               : NULL;
 | 
					                                               : NULL;
 | 
				
			||||||
            gtk_pixmap_set( GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask );
 | 
					            gtk_pixmap_set( GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -371,7 +371,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            GdkBitmap *mask = NULL;
 | 
					            GdkBitmap *mask = NULL;
 | 
				
			||||||
            if ( bitmap.GetMask() )
 | 
					            if ( bitmap.GetMask() )
 | 
				
			||||||
                mask = bitmap.GetMask()->GetBitmap();
 | 
					                mask = bitmap.GetMask()->m_bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            tool_pixmap = gtk_pixmap_new( pixmap, mask );
 | 
					            tool_pixmap = gtk_pixmap_new( pixmap, mask );
 | 
				
			||||||
            gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
 | 
					            gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1103,7 +1103,7 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        wxMask *mask = icon.GetMask();
 | 
					        wxMask *mask = icon.GetMask();
 | 
				
			||||||
        GdkBitmap *bm = NULL;
 | 
					        GdkBitmap *bm = NULL;
 | 
				
			||||||
        if (mask) bm = mask->GetBitmap();
 | 
					        if (mask) bm = mask->m_bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gdk_window_set_icon( m_widget->window, NULL, icon.GetPixmap(), bm );
 | 
					        gdk_window_set_icon( m_widget->window, NULL, icon.GetPixmap(), bm );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -1197,7 +1197,7 @@ static bool do_shape_combine_region(GdkWindow* window, const wxRegion& region)
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            wxBitmap bmp = region.ConvertToBitmap();
 | 
					            wxBitmap bmp = region.ConvertToBitmap();
 | 
				
			||||||
            bmp.SetMask(new wxMask(bmp, *wxBLACK));
 | 
					            bmp.SetMask(new wxMask(bmp, *wxBLACK));
 | 
				
			||||||
            GdkBitmap* mask = bmp.GetMask()->GetBitmap();
 | 
					            GdkBitmap* mask = bmp.GetMask()->m_bitmap;
 | 
				
			||||||
            gdk_window_shape_combine_mask(window, mask, 0, 0);
 | 
					            gdk_window_shape_combine_mask(window, mask, 0, 0);
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user