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

	gint			step_size;
	gint			minimized_size;
	gint			minimize_delay;

	gint			leave_notify_timer_tag;
87 88

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

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

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

128 129 130 131 132 133 134 135 136 137
/*changing parameters*/
void		panel_widget_change_params	(PanelWidget *panel,
						 PanelOrientation orient,
						 PanelSnapped snapped,
						 PanelMode mode,
						 PanelState state,
						 gint step_size,
						 gint minimized_size,
						 gint minimize_delay);

138 139 140 141 142 143
#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* __PANEL_WIDGET_H__ */