gtk_drawing_area: what am i missing?
- From: Andy Kahn <kahn zk3 dec com>
- To: gtk-list redhat com
- Cc: Andy Kahn <kahn zk3 dec com>
- Subject: gtk_drawing_area: what am i missing?
- Date: Tue, 5 May 1998 18:30:52 -0400
hi all,
i'm trying to use gtk_drawing_area_new() to create a new drawing area,
and then manually using gdk_draw_string() to draw a text string inside
of it. however, all i get is a blank window. the code is as follows:
----------------------------------cut here------------------------------------
#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
static void
expose_me(GtkWidget *widget, gpointer data)
{
GdkFont *font;
font = gdk_font_load ("-Adobe-Helvetica-Bold-R-Normal--*-140-*-*-*-*-*-*");
if (font == NULL)
printf("font is NULL\n");
gdk_draw_string (widget->window, font, widget->style->black_gc,
350, 110, "test a;slk jf;lakshdjf ;lj ;lj ;;lakjsd fl;kj");
}
int main (int argc, char **argv)
{
GtkWidget *window, *widget;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
widget = gtk_drawing_area_new ();
gtk_signal_connect (GTK_OBJECT (widget), "expose_event",
GTK_SIGNAL_FUNC (expose_me), NULL);
gtk_drawing_area_size (GTK_DRAWING_AREA (widget), 350, 110);
gtk_container_add (GTK_CONTAINER (window), widget);
gtk_widget_show (widget);
gtk_widget_show (window);
gtk_main ();
return 0;
}
----------------------------------cut here------------------------------------
what am i missing here??
any help would be appreciated. thanks!!
--andy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]