GdkGC *m_textGC;
GdkGC *m_bgGC;
GdkColormap *m_cmap;
+ bool m_isDrawable;
void SetUpDC(void);
GdkWindow *GetWindow(void);
wxMemoryDC( wxDC *dc ); // Create compatible DC
~wxMemoryDC(void);
virtual void SelectObject( const wxBitmap& bitmap );
- void GetSize( int *width, int *height );
+ void GetSize( int *width, int *height ) const;
private:
friend wxPaintDC;
GdkGC *m_textGC;
GdkGC *m_bgGC;
GdkColormap *m_cmap;
+ bool m_isDrawable;
void SetUpDC(void);
GdkWindow *GetWindow(void);
wxMemoryDC( wxDC *dc ); // Create compatible DC
~wxMemoryDC(void);
virtual void SelectObject( const wxBitmap& bitmap );
- void GetSize( int *width, int *height );
+ void GetSize( int *width, int *height ) const;
private:
friend wxPaintDC;
m_height = 0;
m_bpp = 0;
m_palette = NULL;
+#ifdef USE_GDK_IMLIB
+ m_image = NULL;
+#endif
};
wxBitmapRefData::~wxBitmapRefData(void)
M_BMPDATA->m_mask = NULL;
M_BMPDATA->m_pixmap =
gdk_pixmap_new( (GdkWindow*) &gdk_root_parent, width, height, depth );
- gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
+ M_BMPDATA->m_width = width;
+ M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = depth;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
M_BMPDATA->m_mask->m_bitmap = mask;
};
+ gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
+
#else
M_BMPDATA->m_image = gdk_imlib_create_image_from_xpm_data( bits );
#endif
- gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = 24; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
M_BMPDATA->m_mask = NULL;
M_BMPDATA->m_bitmap =
gdk_bitmap_create_from_data( (GdkWindow*) &gdk_root_parent, (gchar *) bits, width, height );
- gdk_window_get_size( M_BMPDATA->m_bitmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
+ M_BMPDATA->m_width = width;
+ M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = 1;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
#ifdef USE_GDK_IMLIB
gdk_imlib_render( M_BMPDATA->m_image, M_BMPDATA->m_image->rgb_width, M_BMPDATA->m_image->rgb_height );
-
+ M_BMPDATA->m_width = M_BMPDATA->m_image->rgb_width;
+ M_BMPDATA->m_height = M_BMPDATA->m_image->rgb_height;
M_BMPDATA->m_pixmap = gdk_imlib_move_image( M_BMPDATA->m_image );
GdkBitmap *mask = gdk_imlib_move_mask( M_BMPDATA->m_image );
if (mask)
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
else
m_cmap = gtk_widget_get_colormap( window->m_widget );
+
+ m_isDrawable = TRUE;
+
SetUpDC();
long x = 0;
if (!Ok()) return;
DestroyClippingRegion();
- gdk_window_clear( m_window );
+
+ if (m_isDrawable)
+ {
+ gdk_window_clear( m_window );
+ }
+ else
+ {
+ int width = 0;
+ int height = 0;
+ GetSize( &width, &height );
+ gdk_draw_rectangle( m_window, m_brushGC, TRUE, 0, 0, width, height );
+ };
};
void wxPaintDC::SetFont( const wxFont &font )
}
SetUpDC();
+
+ m_isDrawable = FALSE;
}
else
{
};
};
-void wxMemoryDC::GetSize( int *width, int *height )
+void wxMemoryDC::GetSize( int *width, int *height ) const
{
if (m_selected.Ok())
{
m_height = 0;
m_bpp = 0;
m_palette = NULL;
+#ifdef USE_GDK_IMLIB
+ m_image = NULL;
+#endif
};
wxBitmapRefData::~wxBitmapRefData(void)
M_BMPDATA->m_mask = NULL;
M_BMPDATA->m_pixmap =
gdk_pixmap_new( (GdkWindow*) &gdk_root_parent, width, height, depth );
- gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
+ M_BMPDATA->m_width = width;
+ M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = depth;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
M_BMPDATA->m_mask->m_bitmap = mask;
};
+ gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
+
#else
M_BMPDATA->m_image = gdk_imlib_create_image_from_xpm_data( bits );
#endif
- gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = 24; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
M_BMPDATA->m_mask = NULL;
M_BMPDATA->m_bitmap =
gdk_bitmap_create_from_data( (GdkWindow*) &gdk_root_parent, (gchar *) bits, width, height );
- gdk_window_get_size( M_BMPDATA->m_bitmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
+ M_BMPDATA->m_width = width;
+ M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = 1;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
#ifdef USE_GDK_IMLIB
gdk_imlib_render( M_BMPDATA->m_image, M_BMPDATA->m_image->rgb_width, M_BMPDATA->m_image->rgb_height );
-
+ M_BMPDATA->m_width = M_BMPDATA->m_image->rgb_width;
+ M_BMPDATA->m_height = M_BMPDATA->m_image->rgb_height;
M_BMPDATA->m_pixmap = gdk_imlib_move_image( M_BMPDATA->m_image );
GdkBitmap *mask = gdk_imlib_move_mask( M_BMPDATA->m_image );
if (mask)
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
else
m_cmap = gtk_widget_get_colormap( window->m_widget );
+
+ m_isDrawable = TRUE;
+
SetUpDC();
long x = 0;
if (!Ok()) return;
DestroyClippingRegion();
- gdk_window_clear( m_window );
+
+ if (m_isDrawable)
+ {
+ gdk_window_clear( m_window );
+ }
+ else
+ {
+ int width = 0;
+ int height = 0;
+ GetSize( &width, &height );
+ gdk_draw_rectangle( m_window, m_brushGC, TRUE, 0, 0, width, height );
+ };
};
void wxPaintDC::SetFont( const wxFont &font )
}
SetUpDC();
+
+ m_isDrawable = FALSE;
}
else
{
};
};
-void wxMemoryDC::GetSize( int *width, int *height )
+void wxMemoryDC::GetSize( int *width, int *height ) const
{
if (m_selected.Ok())
{
wxMemoryDC memDC;
memDC.SelectObject( *my_backstore );
+ memDC.Clear();
memDC.SetBrush( *wxBLACK_BRUSH );
memDC.SetPen( *wxWHITE_PEN );
memDC.DrawRectangle( 0, 0, 150, 150 );