Please explain what I am doing wrong...



Could someone please explain to me why the code below doesn't color the
drawingarea black? And yes, gtk_widget_show is called on everything, it
compiles cleanly etc...

It would be nice if someone could help me, because I have gone through the
scribble-simple example, and as I understand it this is the way to do it
(though apparently I am wrong).


-Stefan


GtkWidget *omgCreateMainMenu( GtkWidget *drawingArea)  {
  gint width, height, nr_rows, dx, dy, depth; 
  GdkPixmap *menupixmap; 

  gdk_window_get_geometry( drawingArea->window, NULL, NULL, &width, 
&height, &depth); 

  nr_rows = (int)(height / MENUITEMHEIGHT); 
  dy = (int)((height - MENUITEMHEIGHT * nr_rows) / 2); 
  dx = (int)((width - MENUITEMWIDTH) / 2); 

  if (dx < 0) 
    dx = 0; 

  width = MENUITEMWIDTH; 
  height = MENUITEMHEIGHT * nr_rows; 

  menupixmap = gdk_pixmap_new( drawingArea->window, width, height, depth); 

  gdk_draw_rectangle (menupixmap,
                      drawingArea->style->black_gc,
                      TRUE,
                      0, 0,
                      width,
                      height); 

  gdk_draw_pixmap(drawingArea->window,
                  drawingArea->style->fg_gc[GTK_WIDGET_STATE(drawingArea)],
                  menupixmap,
                  0, 0,
                  0, 0,
                  width, height); 

  return drawingArea;
  }




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]