panel-widget.h 1.85 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#ifndef __PANEL_WIDGET_H__
#define __PANEL_WIDGET_H__


#include <gdk/gdk.h>
#include <gtk/gtkeventbox.h>


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

18 19
/*this is not actually used in this code, but is a constant one should
  use when calculating how many cells a panel should have*/
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#define PANEL_CELL_SIZE 48

typedef struct _PanelWidget		PanelWidget;
typedef struct _PanelWidgetClass	PanelWidgetClass;

typedef struct _AppletRecord		AppletRecord;
typedef enum {
	PANEL_HORIZONTAL,
	PANEL_VERTICAL
} PanelOrientation;

struct _AppletRecord
{
	GtkWidget		*widget;
	gboolean		is_applet;
};

struct _PanelWidget
{
	GtkEventBox		event_box;

	AppletRecord		**applets;
	gint	 		applet_count;
	GtkTable		*table;

	gint			size;
	PanelOrientation	orientation;
};

struct _PanelWidgetClass
{
	GtkEventBoxClass parent_class;
};

guint		panel_widget_get_type		(void);
GtkWidget*	panel_widget_new		(gint size,
						 PanelOrientation orient);
57
/*add an applet to the panel, preferably at position pos*/
58 59 60
gint		panel_widget_add		(PanelWidget *panel,
						 GtkWidget *applet,
						 gint pos);
61
/*remove an applet from the panel*/
62 63
gint		panel_widget_remove		(PanelWidget *panel,
						 GtkWidget *applet);
64 65
/*return position of an applet*/
gint		panel_widget_get_pos		(PanelWidget *panel,
66
						 GtkWidget *applet);
67 68 69 70 71 72
/*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);
73 74 75 76 77 78 79

#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* __PANEL_WIDGET_H__ */