panel.h 4.06 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 32
#define PANEL_UNKNOWN_APPLET_POSITION -1
#define PANEL_UNKNOWN_STEP_SIZE -1


33
typedef struct {
34
	PanelOrientation orient;
35 36
	PanelSnapped     snapped;
	PanelMode        mode;
37
	gint		 pixmap_enable;
38
	gboolean         fit_pixmap_bg;
39 40
	GtkWidget        *config_box;
} PanelConfig;
Elliot Lee's avatar
Elliot Lee committed
41

42 43
typedef enum {
	APPLET_EXTERN,
44
	APPLET_EXTERN_RESERVED,
45
	APPLET_EXTERN_PENDING,
46
	APPLET_DRAWER,
47
	APPLET_MENU,
48
	APPLET_LOGOUT,
49
	APPLET_SWALLOW,
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
50
	APPLET_LAUNCHER,
51
	APPLET_EMPTY
52 53
} AppletType;

54 55 56 57 58 59 60
typedef enum {
	ORIENT_UP,
	ORIENT_DOWN,
	ORIENT_LEFT,
	ORIENT_RIGHT
} PanelOrientType;

61
typedef struct _AppletUserMenu AppletUserMenu;
62
typedef struct _AppletInfo AppletInfo;
63 64 65 66

struct _AppletUserMenu {
	gchar *name;
	gchar *text;
67
	gint applet_id;
68 69
};

70
struct _AppletInfo {
71
	AppletType type;
72
	int applet_id;
73 74
	GtkWidget *widget; /*an event box*/
	GtkWidget *applet_widget; /*the actual applet widget*/
75
	GtkWidget *assoc; /*associated widget, e.g. a drawer or a menu*/
76
	GtkWidget *menu; /*the applet menu*/
77
	GtkWidget *remove_item; /*remove item in the applet_menu*/
78
	gpointer data;
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
79
	gchar *id_str; /*used for IOR or string Id*/
80
	gchar *cfg; /*used for passing around the per applet config path*/
81 82
	gchar *path; /*used for path on external applets */
	gchar *params; /*used for parameters to applets */
83
	GList *user_menu; /*list of AppletUserMenu items for callbacks*/
84
	gint destroy_callback;
85 86
};

Elliot Lee's avatar
Elliot Lee committed
87

88

89 90 91 92 93 94 95
gint panel_session_save (GnomeClient *client,
			 gint phase,
			 GnomeSaveStyle save_style,
			 gint shutdown,
			 GnomeInteractStyle interact_style,
			 gint fast,
			 gpointer client_data);
96

97 98 99
gint panel_session_die (GnomeClient *client,
			gpointer client_data);

100 101
GtkWidget * create_panel_root_menu(PanelWidget *panel);

102
gint register_toy(GtkWidget *applet,
103
		  GtkWidget *assoc,
104
		  gpointer data,
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
105
		  char *id_str,
106
		  char *path,
107 108 109
		  char *params,
		  int pos,
		  int panel,
110
		  char *cfgpath,
111 112
		  AppletType type);

113 114 115 116
void panel_quit(void);

void apply_global_config(void);

117
void panel_clean_applet(gint applet_id);
118

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

142
extern char *cookie;
143

144
#define get_applet_info(applet_id) \
145 146
	((applet_id>=0 && applet_id<applet_count) ? \
	 (&g_array_index(applets,AppletInfo,applet_id)):NULL)
147

148 149 150 151 152 153 154 155 156 157 158 159 160
/*a few macros to reduce compiler warnings*/
#if (SIZEOF_INT == SIZEOF_VOID_P)
#	define PTOI(p) (gint)((gpointer)p)
#	define ITOP(i) (gpointer)((gint)i)
#elif (SIZEOF_LONG == SIZEOF_VOID_P)
#	define PTOI(p) (glong)((gpointer)p)
#	define ITOP(i) (gpointer)((glong)i)
/*I doubt there is a such a platform, but why not*/
#elif (SIZEOF_SHORT == SIZEOF_VOID_P)
#	define PTOI(p) (gshort)((gpointer)p)
#	define ITOP(i) (gpointer)((gshort)i)
#endif

Elliot Lee's avatar
Elliot Lee committed
161 162 163
END_GNOME_DECLS

#endif