Back to index

lightning-sunbird  0.9+nobinonly
Typedefs | Functions | Variables
nsGtkMenu.cpp File Reference
#include <gtk/gtk.h>
#include "gdksuperwin.h"
#include "gtkmozbox.h"
#include "nsBrowserWindow.h"
#include "resources.h"
#include "nscore.h"
#include <stdio.h>

Go to the source code of this file.

Typedefs

typedef GtkItemFactoryCallback GIFC

Functions

void gtk_ifactory_cb (nsBrowserWindow *nbw, guint callback_action, GtkWidget *widget)
void CreateViewerMenus (nsIWidget *aParent, gpointer data, GtkWidget **aMenuBarOut)

Variables

GtkItemFactoryEntry menu_items []

Typedef Documentation

typedef GtkItemFactoryCallback GIFC

Definition at line 49 of file nsGtkMenu.cpp.


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 );
  gtk_widget_show(menubar);
  gtk_widget_show(mozBox);

  *aMenuBarOut = menubar;
}
void gtk_ifactory_cb ( nsBrowserWindow nbw,
guint  callback_action,
GtkWidget *  widget 
)

Definition at line 51 of file nsGtkMenu.cpp.

{
  nbw->DispatchMenuItem(callback_action);
}

Here is the call graph for this function:


Variable Documentation

GtkItemFactoryEntry menu_items[]

Definition at line 58 of file nsGtkMenu.cpp.