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


#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 ())

17 18
/*this is not actually used in this code, but is a constant one should
  use when calculating how many cells a panel should have*/
19 20
#define PANEL_CELL_SIZE 48

21 22
#define PANEL_MAX 100

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

typedef struct _AppletRecord		AppletRecord;
27
typedef struct _DNDRecord		DNDRecord;
28 29 30 31
typedef enum {
	PANEL_HORIZONTAL,
	PANEL_VERTICAL
} PanelOrientation;
32 33 34 35 36 37 38 39 40
typedef enum {
	PANEL_FREE,
	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
	PANEL_HIDDEN
} PanelState;
48 49 50

struct _AppletRecord
{
51 52
	GtkWidget		*applet;
	GtkWidget		*drawer;
53
	gint			cells;
54 55
};

56
struct _DNDRecord
57
{
58 59
	AppletRecord		*applet;
	GtkWidget		*parent;
60 61
};

62 63
struct _PanelWidget
{
64
	GtkWindow		window;
65

66
	GtkWidget		*fixed;
67
	GtkWidget		*table;
68 69 70 71 72 73 74
	GtkWidget		*hidebutton_n;
	GtkWidget		*hidebutton_e;
	GtkWidget		*hidebutton_w;
	GtkWidget		*hidebutton_s;

	AppletRecord		applets[PANEL_MAX];
	gint	 		applet_count;
75 76

	gint			size;
77 78 79 80
	PanelOrientation	orient;
	PanelSnapped		snapped;
	PanelMode		mode;
	PanelState		state;
81 82 83 84 85 86 87

	gint			step_size;
	gint			minimized_size;
	gint			minimize_delay;
	gint			tooltips_enabled;

	gint			leave_notify_timer_tag;
88 89

	GtkWidget		*currently_dragged_applet;
90
	gint			currently_dragged_applet_pos;
91 92 93 94
};

struct _PanelWidgetClass
{
95
	GtkWindowClass parent_class;
96 97 98
};

guint		panel_widget_get_type		(void);
99 100 101 102
GtkWidget*	panel_widget_new		(gint length,
						 PanelOrientation orient,
						 PanelSnapped snapped,
						 PanelMode mode,
103 104 105 106 107
						 PanelState state,
						 gint step_size,
						 gint minimized_size,
						 gint minimize_delay,
						 gint tooltips_enabled);
108
/*add an applet to the panel, preferably at position pos*/
109 110 111
gint		panel_widget_add		(PanelWidget *panel,
						 GtkWidget *applet,
						 gint pos);
112 113 114 115 116
/*add a drawer (you supply the button) to the panel, preferably at
  position pos*/
gint		panel_widget_add_with_drawer	(PanelWidget *panel,
						 GtkWidget *button,
						 gint pos);
117
/*remove an applet from the panel*/
118 119
gint		panel_widget_remove		(PanelWidget *panel,
						 GtkWidget *applet);
120 121
/*return position of an applet*/
gint		panel_widget_get_pos		(PanelWidget *panel,
122
						 GtkWidget *applet);
123 124 125 126 127 128
/*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);
129 130 131 132 133 134 135

#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* __PANEL_WIDGET_H__ */