Widget creation - Problem with colors



Hi all,

I've got this small problem, I'm busy writing a gtk widget and my color
setting doesn't seem to work.

I've got a widget looking like this

struct test {
  GtkWidget* parent;
  GdkWindow* win;
  .
  .
  .
};


In the widget's realize function I want to create something looking like this
+-----------+
|  X  |   Y              |
|       |                    |
+-----------+

With X one color and Y the other.

X is the base widget's window, and Y is a newly created window object as a
client window of X.

When I set the colors as follows, it doesn't work.

static void
gtk_src_editor_realize (GtkWidget *widget) {
  GdkTest src;
  GdkColor col;
  .
  .
  .

  widget->style = gtk_style_attach (widget->style, widget->window);
 gtk_style_set_background(widget->style,widget->window,GTK_STATE_NORMAL);
/* X */

  col.red = 65535;
  col.green = 0;
  col.blue = 0;
  gdk_window_set_background (src->win, &col);  /* Y */
  .
  .
  .
}

This gives me odd colors for X and Y not WHITE for X and RED for Y as I would
expect.

Hope someone can help me....

Thanx
Jaco Prinsloo



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