Making widgets visible outside their containing window



Hi,

I'm fairly new to GTK (using version 2.24), and I'm wondering if I can
move a widget (partly) outside the area of a window and still have it
displayed.

Consider the following code, where I've tried to use a GtkFixed to
position a label partly outside the window:

==========
int main(int argc, char* argv[])
{
    gtk_init(&argc, &argv);

    GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size(GTK_WINDOW(window), 320, 240);
    gtk_container_border_width(GTK_CONTAINER(window), 10);
    gtk_widget_show(window);

    GtkWidget* fixed = gtk_fixed_new();
    gtk_widget_set_has_window(fixed, TRUE); // Doesn't help
    gtk_container_add(GTK_CONTAINER(window), fixed);
    gtk_widget_show(fixed);

    GtkWidget* label = gtk_label_new("Hello World");
    // y = 238 should position the label partly outside the window
    gtk_fixed_put((GtkFixed*) fixed, label, 0, 238);
    gtk_widget_show(label);

    gtk_main();
    return 0;
}
==========

This is how I want it to look:

-----------------------
|                     |
|                     |
|                     |
|                     |
|--------------       |
-|            |--------
 |            |
 --------------

And this is how it actually looks:

-----------------------
|                     |
|                     |
|                     |
|--------------       |
||            |       |
||            |       |
|--------------       |
-----------------------

As you can see from the comments, I already tried to use
gtk_widget_set_has_window(fixed, TRUE), but it didn't do the
trick. How can I do this?



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