Back to index

lightning-sunbird  0.9+nobinonly
TestGtkEmbedNotebook.cpp
Go to the documentation of this file.
00001 #include <gtk/gtk.h>
00002 #include <gtkmozembed.h>
00003 int main(int argc, char *argv[])
00004 {
00005        GtkWidget *window;
00006        GtkWidget *label;
00007        GtkWidget *mozembed;
00008        GtkWidget *container;
00009        char *url;
00010 
00011        gtk_init(&argc, &argv);
00012        
00013        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
00014        
00015        container = gtk_notebook_new();
00016        mozembed = gtk_moz_embed_new();
00017        label = gtk_label_new("Can you see this message?\n"
00018                            "Once you switch to mozembed page " 
00019                            "you never see this message.");
00020 
00021        gtk_signal_connect(GTK_OBJECT(mozembed), "destroy",
00022                                     GTK_SIGNAL_FUNC(gtk_main_quit),
00023 NULL);
00024 
00025        gtk_container_add(GTK_CONTAINER(window), container);
00026 
00027        gtk_notebook_append_page(GTK_NOTEBOOK(container),
00028                      label,
00029                      gtk_label_new("gtk label"));
00030 
00031        gtk_notebook_append_page(GTK_NOTEBOOK(container),
00032                      mozembed,
00033                      gtk_label_new("mozembed"));
00034 
00035 
00036 
00037 
00038        gtk_widget_set_usize(window, 400, 300);
00039        gtk_widget_show(mozembed);
00040        gtk_widget_show(label);
00041        gtk_widget_show_all(window);
00042 
00043        url = (argc > 1) ? argv[1] : (char *)"localhost";
00044        gtk_moz_embed_load_url(GTK_MOZ_EMBED(mozembed), url);
00045 
00046        gtk_main();
00047        
00048        return 0;
00049 }