panel.h 3.51 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1 2 3
#ifndef PANEL_H
#define PANEL_H

4
#include <glib.h>
5
#include "panel-widget.h"
Elliot Lee's avatar
Elliot Lee committed
6 7 8

BEGIN_GNOME_DECLS

9 10
#define MENU_ID "Menu"
#define DRAWER_ID "Drawer"
11
#define LOGOUT_ID "Logout"
12
#define SWALLOW_ID "Swallow"
13
#define EXTERN_ID "Extern"
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
14
#define LAUNCHER_ID "Launcher"
15

16 17
#define DEFAULT_AUTO_HIDE_STEP_SIZE 10
#define DEFAULT_EXPLICIT_HIDE_STEP_SIZE 50
18
#define DEFAULT_DRAWER_STEP_SIZE 30
19 20 21 22 23

/* amount of time in ms. to wait before lowering panel */
#define DEFAULT_MINIMIZE_DELAY 300

/* number of pixels it'll stick up from the bottom when using
24
   PANEL_AUTO_HIDE */
25 26 27 28
#define DEFAULT_MINIMIZED_SIZE 6

#define DEFAULT_PANEL_NUM 0

29 30 31
#define PANEL_UNKNOWN_APPLET_POSITION -1
#define PANEL_UNKNOWN_STEP_SIZE -1

32 33
typedef enum {
	APPLET_EXTERN,
34
	APPLET_EXTERN_RESERVED,
35
	APPLET_EXTERN_PENDING,
36
	APPLET_DRAWER,
37
	APPLET_MENU,
38
	APPLET_LOGOUT,
39
	APPLET_SWALLOW,
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
40
	APPLET_LAUNCHER,
41
	APPLET_EMPTY
42 43
} AppletType;

44 45 46 47 48 49 50
typedef enum {
	ORIENT_UP,
	ORIENT_DOWN,
	ORIENT_LEFT,
	ORIENT_RIGHT
} PanelOrientType;

51
typedef struct _AppletUserMenu AppletUserMenu;
52
typedef struct _AppletInfo AppletInfo;
53 54

struct _AppletUserMenu {
George Lebl's avatar
George Lebl committed
55 56 57 58
	char *name;
	char *stock_item;
	char *text;
	int applet_id;
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
59 60
	GtkWidget *menuitem;
	GtkWidget *submenu;
61 62
};

63
struct _AppletInfo {
64
	AppletType type;
65
	int applet_id;
66 67
	GtkWidget *widget; /*an event box*/
	GtkWidget *applet_widget; /*the actual applet widget*/
68
	GtkWidget *assoc; /*associated widget, e.g. a drawer or a menu*/
69
	GtkWidget *menu; /*the applet menu*/
70
	GtkWidget *remove_item; /*remove item in the applet_menu*/
71
	gpointer data;
George Lebl's avatar
George Lebl committed
72 73 74 75
	char *id_str; /*used for IOR or string Id*/
	char *cfg; /*used for passing around the per applet config path*/
	char *path; /*used for path on external applets */
	char *params; /*used for parameters to applets */
76
	GList *user_menu; /*list of AppletUserMenu items for callbacks*/
George Lebl's avatar
George Lebl committed
77
	int destroy_callback;
78 79
};

Elliot Lee's avatar
Elliot Lee committed
80

81

George Lebl's avatar
George Lebl committed
82 83
int panel_session_save (GnomeClient *client,
			 int phase,
84
			 GnomeSaveStyle save_style,
George Lebl's avatar
George Lebl committed
85
			 int shutdown,
86
			 GnomeInteractStyle interact_style,
George Lebl's avatar
George Lebl committed
87
			 int fast,
88
			 gpointer client_data);
89

George Lebl's avatar
George Lebl committed
90
int panel_session_die (GnomeClient *client,
91 92
			gpointer client_data);

93
GtkWidget * create_panel_root_menu(GtkWidget *panel);
94

George Lebl's avatar
George Lebl committed
95
int register_toy(GtkWidget *applet,
96
		  GtkWidget *assoc,
97
		  gpointer data,
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
98
		  char *id_str,
99
		  char *path,
100 101
		  char *params,
		  int pos,
102
		  PanelWidget *panel,
103
		  char *cfgpath,
104 105
		  AppletType type);

106 107
void panel_quit(void);

108 109
void panel_sync_config(void);

110 111
void apply_global_config(void);

George Lebl's avatar
George Lebl committed
112
void panel_clean_applet(int applet_id);
113

114
/*stuff for corba*/
115
int applet_request_id (const char *path, const char *param,
George Lebl's avatar
George Lebl committed
116
		       int dorestart, char **cfgpath,
117
		       char **globcfgpath, guint32 *winid);
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
118 119
void applet_register (const char * ior, int applet_id);
guint32 reserve_applet_spot (const char *id_str, const char *path,
120
			     const char *param,
121
			     PanelWidget *panel, int pos, char *cfgpath,
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
122
			     AppletType type);
George Lebl's avatar
George Lebl committed
123 124 125 126 127 128 129 130
void applet_abort_id(int applet_id);
int applet_get_panel(int applet_id);
int applet_get_pos(int applet_id);
PanelOrientType applet_get_panel_orient(int applet_id);
void applet_show_menu(int applet_id);
void applet_drag_start(int applet_id);
void applet_drag_stop(int applet_id);
void applet_add_callback(int applet_id,
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
131
			 char *callback_name,
132
			 char *stock_item,
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
133
			 char *menuitem_text);
George Lebl's avatar
George Lebl committed
134
void applet_remove_callback(int applet_id,
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
135
			    char *callback_name);
George Lebl's avatar
George Lebl committed
136
void applet_set_tooltip(int applet_id, const char *tooltip);
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
137

138
extern char *cookie;
139

140
#define get_applet_info(applet_id) \
141 142
	((applet_id>=0 && applet_id<applet_count) ? \
	 (&g_array_index(applets,AppletInfo,applet_id)):NULL)
143

Elliot Lee's avatar
Elliot Lee committed
144 145 146
END_GNOME_DECLS

#endif