panel-widget.h 3.44 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

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

20
#define PANEL_DRAWER_DROP_TARGET_SIZE 5
21

22 23 24 25
typedef struct _PanelWidget		PanelWidget;
typedef struct _PanelWidgetClass	PanelWidgetClass;

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

struct _AppletRecord
{
57
	GtkWidget		*applet;
58
	gint			cells;
59 60
};

61
struct _DNDRecord
62
{
63 64
	AppletRecord		*applet;
	GtkWidget		*parent;
65 66
};

67 68
struct _PanelWidget
{
69
	GtkWindow		window;
70

71
	GtkWidget		*fixed;
72
	GtkWidget		*table;
73 74 75 76 77 78 79
	GtkWidget		*hidebutton_n;
	GtkWidget		*hidebutton_e;
	GtkWidget		*hidebutton_w;
	GtkWidget		*hidebutton_s;

	AppletRecord		applets[PANEL_MAX];
	gint	 		applet_count;
80 81

	gint			size;
82 83 84 85
	PanelOrientation	orient;
	PanelSnapped		snapped;
	PanelMode		mode;
	PanelState		state;
86 87 88 89 90 91

	gint			step_size;
	gint			minimized_size;
	gint			minimize_delay;

	gint			leave_notify_timer_tag;
92 93

	GtkWidget		*currently_dragged_applet;
94
	gint			currently_dragged_applet_pos;
95

96 97 98
	GtkWidget		*drawer_drop_zone;
	DrawerDropZonePos	drawer_drop_zone_pos;

99
	gint			thick;
100 101 102 103
};

struct _PanelWidgetClass
{
104
	GtkWindowClass parent_class;
105 106 107
};

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

129
/*remove an applet from the panel*/
130 131
gint		panel_widget_remove		(PanelWidget *panel,
						 GtkWidget *applet);
132 133
/*return position of an applet*/
gint		panel_widget_get_pos		(PanelWidget *panel,
134
						 GtkWidget *applet);
135 136 137 138 139 140
/*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);
141 142 143
/*initiate drag*/
void		panel_widget_applet_drag_start	(PanelWidget *panel,
						 GtkWidget *applet);
144

145 146 147 148 149 150 151 152
/*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
153 154 155
						 gint minimize_delay,
						 DrawerDropZonePos
						 	drop_zone_pos);
156

157 158 159 160 161 162
#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* __PANEL_WIDGET_H__ */