GtkDrawingArea vs GtkCheckButton



I've run into some puzzling behavior with a few classes of widgets.

I've got a drawing area in front of which I place various widgets.
Most widget types work fine.  However, GtkRadioButton, GtkCheckButton, 
and GtkLabel are obscured by the drawing area which should be behind 
them.  Widgets such as GtkButton and GtkToggleButton don't have this 
problem.

I've traced through the gtk code somewhat, but I'm not familiar enough 
with how things are layered and clipped to understand the behavior.


Here is some sample code which shows the difference between GtkButton 
and GtkCheckButton:

#include <gnome.h>

GtkWidget *makeFixedContainer();
gint eventDelete(GtkWidget *widget,
        GdkEvent *event,gpointer data);
gint eventDestroy(GtkWidget *widget,
        GdkEvent *event,gpointer data);

#define WIDTH 400
#define HEIGHT 300

int main(int argc,char *argv[])
{
    GtkWidget *window;
    GtkWidget *fixed;

    gnome_init("fixed","1.0",argc,argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size(GTK_WINDOW(window),
            WIDTH,HEIGHT);
    gtk_signal_connect(GTK_OBJECT(window),
            "delete_event",
            GTK_SIGNAL_FUNC(eventDelete),
            NULL);
    gtk_signal_connect(GTK_OBJECT(window),
            "destroy",
            GTK_SIGNAL_FUNC(eventDestroy),
            NULL);

    fixed = makeFixedContainer();

    gtk_container_add(GTK_CONTAINER(window),fixed);
    gtk_widget_show(window);
    gtk_main();
    exit(0);
}

GtkWidget *makeFixedContainer() {
    GtkWidget *fixed;
    GtkWidget *drawable;
    GtkWidget *button;

    fixed = gtk_fixed_new();
    gtk_widget_show(fixed);
	
	drawable = gtk_drawing_area_new();
	gtk_widget_set_usize(drawable, 130, 115);
	gtk_fixed_put(GTK_FIXED(fixed),drawable, 0,0);
    gtk_widget_show(drawable);

    button = gtk_check_button_new_with_label("Now is the time for all 
good men to come to the aid of their country");
    gtk_widget_show(button);
    gtk_fixed_put(GTK_FIXED(fixed),button, 90, 0);

    button = gtk_button_new_with_label("Now is the time for all good 
men to come to the aid of their country");
    gtk_widget_show(button);
    gtk_fixed_put(GTK_FIXED(fixed),button, 90, 40);

    return(fixed);
}

gint eventDelete(GtkWidget *widget,
        GdkEvent *event,gpointer data) {
    return(FALSE);
}
gint eventDestroy(GtkWidget *widget,
        GdkEvent *event,gpointer data) {
    gtk_main_quit();
    return(0);
}





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