panel-widget.h 2.5 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 _WorkspaceDesc		WorkspaceDesc;
28 29 30 31
typedef enum {
	PANEL_HORIZONTAL,
	PANEL_VERTICAL
} PanelOrientation;
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
typedef enum {
	PANEL_FREE,
	PANEL_TOP,
	PANEL_BOTTOM,
	PANEL_LEFT,
	PANEL_RIGHT
} PanelSnapped;
typedef enum {
	PANEL_EXPLICIT_HIDE,
	PANEL_AUTOH_IDE
} PanelMode;
typedef enum {
	PANEL_SHOWN,
	PANEL_HIDDEN
} PanelState;
47 48 49

struct _AppletRecord
{
50 51
	GtkWidget		*applet;
	GtkWidget		*drawer;
52 53
};

54 55 56 57 58 59 60 61
struct _WorkspaceDesc
{
	GList			*panels;
	GList			*deskareas;
	GtkWidget		*current_dragged_applet;
	GtkWidget		*current_dragged_parent;
};

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
};

struct _PanelWidgetClass
{
85
	GtkWindowClass parent_class;
86 87 88
};

guint		panel_widget_get_type		(void);
89 90 91 92 93
GtkWidget*	panel_widget_new		(gint length,
						 PanelOrientation orient,
						 PanelSnapped snapped,
						 PanelMode mode,
						 PanelState state);
94
/*add an applet to the panel, preferably at position pos*/
95 96 97
gint		panel_widget_add		(PanelWidget *panel,
						 GtkWidget *applet,
						 gint pos);
98
/*remove an applet from the panel*/
99 100
gint		panel_widget_remove		(PanelWidget *panel,
						 GtkWidget *applet);
101 102
/*return position of an applet*/
gint		panel_widget_get_pos		(PanelWidget *panel,
103
						 GtkWidget *applet);
104 105 106 107 108 109
/*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);
110 111 112 113 114 115 116

#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* __PANEL_WIDGET_H__ */