ROX-CLib: menu.c File Reference

- Main Page
- Data Structures
- Files
- Related Pages

- File List
- Globals

# menu.c File Reference

Help for building ROX-style menus. More...

`#include "rox-clib.h"`
`#include <stdlib.h>`
`#include <glib.h>`
`#include <gtk/gtk.h>`
`#include "rox.h"`
`#include "menu.h"`
`#include "applet.h"`

## Functions
GtkWidget * | rox_menu_build (GtkWidget *window, GtkItemFactoryEntry *menu_items, int n_menu, const gchar *menu_name, const gchar *accel_name)
GtkWidget * | rox_menu_get_widget (GtkWidget *menu, const char *path)
void | rox_menu_attach (GtkWidget *menu, GtkWidget *window, gboolean on_button_press, ROXMenuPreFilter filter, gpointer udata)
void | rox_menu_attach_to_applet (GtkWidget *menu, GtkWidget *applet, ROXMenuPreFilter filter, gpointer udata)

## Detailed Description

Help for building ROX-style menus.

## Function Documentation

void rox_menu_attach | ( | GtkWidget * | menu,
|  | GtkWidget * | window,
|  | gboolean | on_button_press,
|  | ROXMenuPreFilter | filter,
|  | gpointer | udata |
| ) |  |  |

Attach a menu to a window (or other widget). The menu will be displayed when the "popup-menu" signal is triggered on window and optionally when the "button_press_event" signal is triggered.

Parameters:

  `[in]` | menu | menu to attach
  `[in,out]` | window | widget to attach menu to
  `[in]` | on_button_press | if not `FALSE` then pop-up the menu on the "button_press_event" signal, otherwise just on the "popup-menu" signal.
  `[in]` | filter | function to call prior to showing the menu, or `NULL`
  `[in]` | udata | additional data to pass to filter when calling.

void rox_menu_attach_to_applet | ( | GtkWidget * | menu,
|  | GtkWidget * | applet,
|  | ROXMenuPreFilter | filter,
|  | gpointer | udata |
| ) |  |  |

Attach a menu to an applet's window. The menu will be displayed when the "popup-menu" signal or button_press_event" signal is triggered on applet.

Parameters:

  `[in]` | menu | menu to attach
  `[in,out]` | applet | widget to attach menu to
  `[in]` | filter | function to call prior to showing the menu, or `NULL`
  `[in]` | udata | additional data to pass to filter when calling.

GtkWidget* rox_menu_build | ( | GtkWidget * | window,
|  | GtkItemFactoryEntry * | menu_items,
|  | int | n_menu,
|  | const gchar * | menu_name,
|  | const gchar * | accel_name |
| ) |  |  |

Create a menu. The menu is built from a static definition and connected to a window for the purposes of reacting to key accelerators. It is not attached to a window, use either rox_menu_attach() or rox_menu_attach_to_applet().

Parameters:

  `[in,out]` | window | window listening for key events that will be used for key accelerators (or `NULL`)
  `[in]` | menu_items | array of menu definitions.
  `[in]` | n_menu | number of items in menu_items
  `[in]` | menu_name | name of menu to create, or `NULL` to use "<system>"
  `[in]` | accel_name | file name to use when loading or saving key accelerators, or `NULL` to disable loading and saving.

GtkWidget* rox_menu_get_widget | ( | GtkWidget * | menu,
|  | const char * | path |
| ) |  |  |

Look up a menu widget by its path in a menu created by rox_menu_build().

Parameters:

  `[in]` | menu | menu created by rox_menu_build().
  `[in]` | path | path of a menu widget, one of the menu_items passed to rox_menu_build().

Returns:
  menu widget or `NULL` if not found.