Back to index

lightning-sunbird  0.9+nobinonly
Typedefs | Functions
nsGtkMenu.h File Reference
#include "nscore.h"
#include <gtk/gtkwidget.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


typedef void(* MenuCallbackProc )(PRUint32)


void CreateViewerMenus (nsIWidget *aParent, gpointer data, GtkWidget **aMenuBarOut)

Typedef Documentation

Definition at line 44 of file nsGtkMenu.h.

Function Documentation

void CreateViewerMenus ( nsIWidget aParent,
gpointer  data,
GtkWidget **  aMenuBarOut 

Definition at line 164 of file nsGtkMenu.cpp.

  NS_ASSERTION(nsnull != aParent,"null parent.");
  NS_ASSERTION(nsnull != aMenuBarOut,"null out param.");

  GtkItemFactory *item_factory;
  GtkWidget *menubar;

  GdkSuperWin *gdkSuperWin;
  GtkWidget   *mozBox;

  gdkSuperWin = (GdkSuperWin*)aParent->GetNativeData(NS_NATIVE_WIDGET);
  int nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
  item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", nsnull);

  gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, data);

  menubar = gtk_item_factory_get_widget (item_factory, "<main>");

  gtk_menu_bar_set_shadow_type (GTK_MENU_BAR(menubar), GTK_SHADOW_NONE);

  NS_ASSERTION(GDK_IS_SUPERWIN(gdkSuperWin), "code assumes a gdksuperwin.");
  mozBox = gtk_mozbox_new(gdkSuperWin->bin_window);
  NS_ASSERTION((mozBox != NULL), "failed to create mozBox.");

  gtk_container_add(GTK_CONTAINER(mozBox), menubar);
  gtk_mozbox_set_position(GTK_MOZBOX(mozBox), 0, 0 );

  *aMenuBarOut = menubar;

Here is the call graph for this function: