Re: [gtk-list] Re: Using GtkPreview/gtk_preview_draw_row
- From: Eden Li <tile primenet com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Using GtkPreview/gtk_preview_draw_row
- Date: Mon, 5 Jul 1999 22:42:55 +0000 (GMT)
Hrmm.. It still doesn't work. I create a GtkDrawingArea, set it's
width/height, add the GDK_EXPOSURE_MASK to it's events connect the
expose_event signal to a signal handler that draws a rectangle w/ the
given color, and then shows the widget and returns it. But it still shows
a black rectangle instead of the correct color. Here's my rect drawing
code from the expose_event handler, I'm supposing it's incorrect:
(swatch is a GtkDrawingArea* instantiated as a GtkWidget*)
---
GdkGC *gc;
gc = gdk_gc_new (swatch->window);
gdk_gc_set_foreground (gc, col);
gdk_gc_set_background (gc, col);
gdk_gc_set_fill (gc, GDK_SOLID);
gdk_draw_rectangle (swatch->window, gc, TRUE, 0, 0, SWATCH_WIDTH,
SWATCH_HEIGHT);
gdk_gc_destroy (gc);
gtk_widget_queue_draw (swatch);
---
I get no Gdk or Gtk ERRORs or WARNINGs, it just displays a black rectangle
instead of the proper color. Is this code wrong for what I want?
Eden Li
tile@linuxgames.com
On Mon, 5 Jul 1999, Havoc Pennington wrote:
|Hi,
|
|If you just want a swatch of color, it's probably easier to simply create
|a drawing area, and have an expose event handler that does
|gdk_draw_rectangle() to draw a rectangle in the color you want.
|I think GnomeColorPicker does this for its color swatch.
|
|Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]