RE: Newbie questions - Frames (Using GtkCanvas)



I knocked up the following code to test this stuff :


-----Cut Here-----


#include <gtk/gtk.h>
#include <gtk-canvas.h>


/*
compiled with : 

cc t1.c -o t1 -lgtk -lgdk -lgtk-canvas  -lart_lgpl

*/
#define STYLE GTK_SHADOW_IN

int
main (int argc, char *argv[])
{
        GtkWidget *app;
        GtkWidget *c;
        GtkFrame *frame1;
        GtkFrame *frame2;
        GtkFixed *f1;
        GtkFixed *f2;
        GtkCanvasGroup *root;
        int i;

        gtk_init (&argc, &argv);
        gtk_canvas_init();

        app = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        c = gtk_canvas_new ();
        gtk_container_add(GTK_CONTAINER(app),c);
        gtk_widget_show(c);
        gtk_widget_show(app);

        frame1 = gtk_frame_new (0);
        gtk_widget_set_usize (GTK_WIDGET (frame1), 200,200);

        frame2 = gtk_frame_new (0);
        gtk_widget_set_usize (GTK_WIDGET (frame2), 200,200);

          root = gtk_canvas_root (GTK_CANVAS (c));


          gtk_canvas_item_new (root, gtk_canvas_widget_get_type (),
                      "widget", frame1,
                      "x", (double)100,
                      "y", (double)100,
                      "width", (double)200,
                      "height", (double)200,
                      "anchor", GTK_ANCHOR_NW,
                      "size_pixels", FALSE, NULL);

          gtk_canvas_item_new (root, gtk_canvas_widget_get_type (),
                      "widget", frame2,
                      "x", (double)150,
                      "y", (double)150,
                      "width", (double)200,
                      "height", (double)200,
                      "anchor", GTK_ANCHOR_NW,
                      "size_pixels", FALSE, NULL);

        f1=gtk_fixed_new();
        f2=gtk_fixed_new();
        gtk_container_add(frame1,f1);
        gtk_container_add(frame2,f2);
        gtk_widget_show(f1);
        gtk_widget_show(f2);
        gtk_frame_set_shadow_type (GTK_FRAME (frame1), STYLE);
        gtk_frame_set_shadow_type (GTK_FRAME (frame2), STYLE);
        gtk_widget_show(frame1);
        gtk_widget_show(frame2);
gtk_main();
}

-----Cut Here-----



But this still exhibits the same problem - Do f1 and f2 need to be GtkCanvas
as well ?
Do f1 and f2 need to be GtkCanvas instead of 'c' ?


Any help greatly appreciated




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