menu.h 3.47 KB
Newer Older
1 2 3
#ifndef MENU_H
#define MENU_H

4
#include <panel-widget.h>
5
#include "applet.h"
6

7
G_BEGIN_DECLS
8

9
enum {
10 11
	/* FIXME: should we move this array or keep the bitvalues
	 * the same??? */
12 13
	MAIN_MENU_SYSTEM = 1<<2,
	MAIN_MENU_SYSTEM_SUB = 1<<3,
14 15
	MAIN_MENU_DISTRIBUTION = 1<<4,
	MAIN_MENU_DISTRIBUTION_SUB = 1<<5,
16 17
	MAIN_MENU_KDE = 1<<6,
	MAIN_MENU_KDE_SUB = 1<<7,
18
	MAIN_MENU_APPLETS = 1<<10,
19 20 21 22 23
	MAIN_MENU_APPLETS_SUB = 1<<11,
	MAIN_MENU_PANEL = 1<<12,
	MAIN_MENU_PANEL_SUB = 1<<13,
	MAIN_MENU_DESKTOP = 1<<14,
	MAIN_MENU_DESKTOP_SUB = 1<<15
24 25
};

26 27 28
/* this is defined in menu-properties.c */
typedef struct _MenuDialogInfo MenuDialogInfo;

29 30
typedef struct _Menu Menu;
struct _Menu {
31 32 33 34
	GtkWidget		*button;
	GtkWidget		*menu;
	gboolean		 custom_icon;
	char			*custom_icon_file;
35 36 37

	gboolean		 main_menu;
	/* If this is the main menu then path is irrelevant */
38
	char			*path;
39

40
	gboolean		 global_main;
41 42 43
	/* if global_main is on then main_menu_flags are irrelevant */
	int			 main_menu_flags;

44 45 46 47
	int			 age;
	GtkWidget		*prop_dialog;
	MenuDialogInfo		*dialog_info;
	AppletInfo		*info;
48
};
49

Mark McLoughlin's avatar
Mark McLoughlin committed
50 51 52 53 54 55
void		load_menu_applet	(const char  *path,
					 gboolean     main_menu,
					 int          main_menu_flags,
					 gboolean     global_main,
					 gboolean     custom_icon,
					 const char  *custom_icon_file,
56
					 PanelWidget *panel,
Mark McLoughlin's avatar
Mark McLoughlin committed
57 58 59 60
					 int          pos,
					 gboolean     exactpos,
					 const char  *gconf_key);

61 62 63 64 65 66
void		add_menu_widget		(Menu *menu,
					 PanelWidget *panel,
					 GSList *menudirl,
					 gboolean fake_subs);

void		set_menu_applet_orient	(Menu *menu,
67
					 PanelOrient orient);
68 69 70 71 72 73 74 75

void		setup_menuitem		(GtkWidget *menuitem,
					 GtkWidget *pixmap,
					 const char *title);
void		make_panel_submenu	(GtkWidget *menu,
					 gboolean fake_submenus,
					 gboolean is_basep);

76
GtkWidget *	create_panel_root_menu	(PanelWidget *panel);
77 78 79 80 81

void		menu_properties		(Menu *menu);

void		panel_lock		(GtkWidget *widget,
					 gpointer data);
82

83
/*to be called on startup to load in some of the directories*/
84 85 86 87 88
void		init_menus		(void);

GtkWidget *	create_menu_at		(GtkWidget *menu,
					 const char *menudir,
					 gboolean applets,
89
					 gboolean launcher_add,
90 91 92
					 const char *dir_name,
					 const char *pixmap_name,
					 gboolean fake_submenus,
93
					 gboolean force);
94 95
GtkWidget *	create_fake_menu_at	(const char *menudir,
					 gboolean applets,
96
					 gboolean launcher_add,
97
					 const char *dir_name,
98
					 const char *pixmap_name);
99 100 101 102 103 104 105 106 107 108

void		submenu_to_display	(GtkWidget *menuw, gpointer data);
gboolean	menu_need_reread	(GtkWidget *menuw);

void		setup_internal_applet_drag (GtkWidget *menuitem,
					    const char *applet_type);
GtkWidget *	create_root_menu	(GtkWidget *root_menu,
					 gboolean fake_submenus,
					 int flags,
					 gboolean is_basep,
109
					 gboolean run_item);
110

111
/* some gtk code cut-n-paste action */
112
void		our_gtk_menu_position	(GtkMenu *menu);
113

114
void            menu_save_to_gconf   (Menu       *menu,
Mark McLoughlin's avatar
Mark McLoughlin committed
115 116 117 118
				      const char *gconf_key);

void            menu_load_from_gconf (PanelWidget *panel_widget,
				      gint         position,
119 120
				      const char  *gconf_key,
				      gboolean     use_default);
Mark McLoughlin's avatar
Mark McLoughlin committed
121

122 123 124 125 126 127 128
/* perhaps into basep-widget.h? */
enum {
	HIDEBUTTONS_PIXMAP,
	HIDEBUTTONS_PLAIN,
	HIDEBUTTONS_NONE
};

129
#define PANEL_MENU_HAVE_ICONS_KEY "/desktop/gnome/menus/show-icons"
130 131
gboolean panel_menu_have_icons   (void);

132 133 134 135 136 137
GtkWidget *	panel_menu_new		(void);
void		panel_load_menu_image_deferred (GtkWidget *image_menu_item,
						const char *image_filename,
						const char *fallback_image_filename,
						gboolean force_image);

138

139
G_END_DECLS
140 141

#endif