GtkDrawingArea alignment
- From: yanxin <ycui wmsvision com>
- To: gtk-app-devel-list gnome org
- Subject: GtkDrawingArea alignment
- Date: Fri, 30 Aug 2002 15:39:08 -0700
I draw a vbox first-> then pack the GtkDrawingArea into the vbox-> then
packed a label into the box, then pack the vbox into a GtkButton. In the
expose event, I use gdk_draw_rgb_32_image() to update the image of the
drawing area, but the image is always aligned to the left. How to make
the image align in the middle of the vbox?
========= here is part of my code to trigger the expose event
===========
if ( psPixbuf ) {
/* Update the current image */
psImage->psPixbuf = psPixbuf;
psImage->psMask = psMask;
/* Determine the refresh area of the image. */
rect.x = 0;
rect.y = 0;
rect.width = gdk_pixbuf_get_width( psPixbuf );
rect.height = gdk_pixbuf_get_height( psPixbuf );
if( psImage->psButton &&
(psImage->eTextAlignment == align_Top ||
psImage->eTextAlignment == align_Bottom) )
rect.x =
(psImage->psDrawingArea->allocation.width -
gdk_pixbuf_get_width(psPixbuf) )/2;
/* Trigger an expose_event to flush the changes to the
* drawing area
*/
gtk_widget_draw( psDrawingArea, &rect );
}
=================================
Thanks
Yanxin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]