panel-widget.h 3.84 KB
Newer Older
1 2 3 4
#ifndef __PANEL_WIDGET_H__
#define __PANEL_WIDGET_H__


5
#include <gtk/gtk.h>
6 7 8 9 10 11 12 13 14 15

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


#define PANEL_WIDGET(obj)          GTK_CHECK_CAST (obj, panel_widget_get_type (), PanelWidget)
#define PANEL_WIDGET_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, panel_widget_get_type (), PanelWidgetClass)
#define IS_PANEL_WIDGET(obj)       GTK_CHECK_TYPE (obj, panel_widget_get_type ())

16
#define PANEL_CELL_SIZE 10
17
#define PANEL_MINIMUM_WIDTH 48
18

19 20
#define PANEL_MAX 1000 /*10,000 long screen, FIXME! make dynamic*/

21
#define PANEL_DRAWER_DROP_TARGET_SIZE 5
22

23 24
#define PANEL_APPLET_PARENT_KEY "panel_applet_parent_key"

25 26 27 28
typedef struct _PanelWidget		PanelWidget;
typedef struct _PanelWidgetClass	PanelWidgetClass;

typedef struct _AppletRecord		AppletRecord;
29
typedef struct _DNDRecord		DNDRecord;
30 31 32 33
typedef enum {
	PANEL_HORIZONTAL,
	PANEL_VERTICAL
} PanelOrientation;
34 35
typedef enum {
	PANEL_FREE,
36
	PANEL_DRAWER,
37 38 39 40 41 42 43
	PANEL_TOP,
	PANEL_BOTTOM,
	PANEL_LEFT,
	PANEL_RIGHT
} PanelSnapped;
typedef enum {
	PANEL_EXPLICIT_HIDE,
44
	PANEL_AUTO_HIDE
45 46 47
} PanelMode;
typedef enum {
	PANEL_SHOWN,
48
	PANEL_MOVING,
49 50 51
	PANEL_HIDDEN,
	PANEL_HIDDEN_RIGHT,
	PANEL_HIDDEN_LEFT
52
} PanelState;
53
typedef enum {
54 55
	DROP_ZONE_LEFT,
	DROP_ZONE_RIGHT
56
} DrawerDropZonePos;
57 58 59

struct _AppletRecord
{
60
	GtkWidget		*applet;
61
	gint			cells;
62 63
};

64
struct _DNDRecord
65
{
66 67
	AppletRecord		*applet;
	GtkWidget		*parent;
68 69
};

70 71
struct _PanelWidget
{
72
	GtkWindow		window;
73

74
	GtkWidget		*fixed;
75
	GtkWidget		*table;
76 77 78 79 80 81 82
	GtkWidget		*hidebutton_n;
	GtkWidget		*hidebutton_e;
	GtkWidget		*hidebutton_w;
	GtkWidget		*hidebutton_s;

	AppletRecord		applets[PANEL_MAX];
	gint	 		applet_count;
83 84

	gint			size;
85 86 87 88
	PanelOrientation	orient;
	PanelSnapped		snapped;
	PanelMode		mode;
	PanelState		state;
89 90 91 92 93 94

	gint			step_size;
	gint			minimized_size;
	gint			minimize_delay;

	gint			leave_notify_timer_tag;
95 96

	GtkWidget		*currently_dragged_applet;
97
	gint			currently_dragged_applet_pos;
98

99 100 101
	GtkWidget		*drawer_drop_zone;
	DrawerDropZonePos	drawer_drop_zone_pos;

102
	gint			thick;
103 104 105 106
};

struct _PanelWidgetClass
{
107
	GtkWindowClass parent_class;
108 109 110
};

guint		panel_widget_get_type		(void);
111
GtkWidget*	panel_widget_new		(gint size,
112 113 114
						 PanelOrientation orient,
						 PanelSnapped snapped,
						 PanelMode mode,
115 116 117
						 PanelState state,
						 gint step_size,
						 gint minimized_size,
118 119
						 gint minimize_delay,
						 gint pos_x,
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
120 121 122
						 gint pos_y,
						 DrawerDropZonePos
						 	drop_zone_pos);
123
/*add an applet to the panel, preferably at position pos*/
124 125 126
gint		panel_widget_add		(PanelWidget *panel,
						 GtkWidget *applet,
						 gint pos);
127 128 129 130 131
/*move oldpos to newpos*/
gint		panel_widget_move		(PanelWidget *panel,
						 gint oldpos,
						 gint pos);

132
/*remove an applet from the panel*/
133 134
gint		panel_widget_remove		(PanelWidget *panel,
						 GtkWidget *applet);
135 136
/*return position of an applet*/
gint		panel_widget_get_pos		(PanelWidget *panel,
137
						 GtkWidget *applet);
138 139 140 141 142 143
/*return a list of all applets*/
GList*		panel_widget_get_applets	(PanelWidget *panel);
/*run func for each applet*/
void		panel_widget_foreach		(PanelWidget *panel,
						 GFunc func,
						 gpointer user_data);
144 145 146
/*initiate drag*/
void		panel_widget_applet_drag_start	(PanelWidget *panel,
						 GtkWidget *applet);
147

148 149 150 151 152 153 154
/*needed for corba*/
void		panel_widget_applet_drag_start_no_grab(PanelWidget *panel,
						       GtkWidget *applet);
void		panel_widget_applet_drag_end_no_grab(PanelWidget *panel);
int		panel_widget_applet_move_to_cursor(PanelWidget *panel);
void		panel_widget_applet_move_use_idle(PanelWidget *panel);

155 156 157 158 159 160 161 162
/*changing parameters*/
void		panel_widget_change_params	(PanelWidget *panel,
						 PanelOrientation orient,
						 PanelSnapped snapped,
						 PanelMode mode,
						 PanelState state,
						 gint step_size,
						 gint minimized_size,
Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
163 164 165
						 gint minimize_delay,
						 DrawerDropZonePos
						 	drop_zone_pos);
166

167 168 169 170 171 172
#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* __PANEL_WIDGET_H__ */