Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
TestGtkEmbedMDI.cpp File Reference
#include <gnome.h>
#include "gtkmozembed.h"

Go to the source code of this file.

Defines

#define USE_MOZILLA_TEST
 simplemdi.c
#define SAMPLE_PIXMAP

Functions

gint eventDelete (GtkWidget *widget, GdkEvent *event, gpointer data)
gint eventDestroy (GtkWidget *widget, GdkEvent *event, gpointer data)
static void addChild (GtkObject *mdi, gchar *name)
static GtkWidget * setLabel (GnomeMDIChild *child, GtkWidget *currentLabel, gpointer data)
static GtkWidget * createView (GnomeMDIChild *child, gpointer data)
int main (int argc, char *argv[])

Define Documentation

Definition at line 42 of file TestGtkEmbedMDI.cpp.

simplemdi.c

Definition at line 27 of file TestGtkEmbedMDI.cpp.


Function Documentation

static void addChild ( GtkObject *  mdi,
gchar *  name 
) [static]

Definition at line 76 of file TestGtkEmbedMDI.cpp.

{
    GnomeMDIGenericChild *child;

    child = gnome_mdi_generic_child_new(name);
    gnome_mdi_add_child(GNOME_MDI(mdi),
            GNOME_MDI_CHILD(child));

    gnome_mdi_generic_child_set_view_creator(child,
            createView,name);
    gnome_mdi_generic_child_set_label_func(child,setLabel,
            NULL);
    gnome_mdi_add_view(GNOME_MDI(mdi),
            GNOME_MDI_CHILD(child));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static GtkWidget * createView ( GnomeMDIChild *  child,
gpointer  data 
) [static]

Definition at line 91 of file TestGtkEmbedMDI.cpp.

{
#ifdef USE_MOZILLA_TEST
    GtkWidget *browser = gtk_moz_embed_new();
#else
#ifndef SAMPLE_PIXMAP
    GtkWidget *browser = gtk_label_new("lynx 0.01a");
#else
    /* Another example -- */
    GtkWidget *browser =
      gnome_pixmap_new_from_file("/usr/share/pixmaps/emacs.png");
#endif /* SAMPLE_PIXMAP */
#endif /* USE_MOZILLA_TEST */

    GtkWidget *notebook = gtk_notebook_new();
    char str[80];

    sprintf(str,"View of the\n%s widget",(gchar *)data);

#ifdef USE_MOZILLA_TEST
    gtk_moz_embed_load_url(GTK_MOZ_EMBED(browser), "http://www.mozilla.org");
#endif /* USE_MOZILLA_TEST */

#ifndef SIMPLER_TEST
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), gtk_label_new(str),
                          gtk_label_new("Label"));
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), browser,
                          gtk_label_new("Mozilla"));
    gtk_widget_show_all(notebook);
    return (notebook);
#else
    gtk_widget_show(browser);
    return (browser);
#endif /* SIMPLER_TEST */
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 138 of file TestGtkEmbedMDI.cpp.

                                       {
    gtk_main_quit();
    return(0);
}

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 56 of file TestGtkEmbedMDI.cpp.

{
    GtkObject *mdi;

    gnome_init("simplemdi","1.0",argc,argv);
    mdi = gnome_mdi_new("simplemdi","Simple MDI");
    gtk_signal_connect(mdi,"destroy",
            GTK_SIGNAL_FUNC(eventDestroy),NULL);

    addChild(mdi,"First");
    addChild(mdi,"Second");
    addChild(mdi,"Third");
    addChild(mdi,"Last");

    gnome_mdi_set_mode(GNOME_MDI(mdi),GNOME_MDI_NOTEBOOK);
    //gnome_mdi_open_toplevel(GNOME_MDI(mdi));

    gtk_main();
    exit(0);
}

Here is the call graph for this function:

static GtkWidget * setLabel ( GnomeMDIChild *  child,
GtkWidget *  currentLabel,
gpointer  data 
) [static]

Definition at line 128 of file TestGtkEmbedMDI.cpp.

{
    if(currentLabel == NULL)
        return(gtk_label_new(child->name));

    gtk_label_set_text(GTK_LABEL(currentLabel),
            child->name);
    return(currentLabel);
}

Here is the caller graph for this function: