/* $Id: docklet.h,v 1.6 2007/09/07 21:38:22 mgdepalma Exp $
 *
 * Copyright (C) 2007 Softcraft Impresa, LLC <info@softcraft.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; You may only use version 2 of the License,
 * you have no option to use any other version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef DOCKLET_H
#define DOCKLET_H

#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <gtk/gtk.h>

G_BEGIN_DECLS

#define DOCKLET_TYPE (docklet_get_type ())
#define DOCKLET(obj) \
           (G_TYPE_CHECK_INSTANCE_CAST (obj, DOCKLET_TYPE, Docklet))

typedef struct _Docklet       Docklet;
typedef struct _DockletClass  DockletClass;
typedef struct _DockletDatum  DockletDatum;

struct _Docklet
{
  GtkObject parent;	/* Docklet inherits from GTK_TYPE_OBJECT */

  GtkFunction agent;    /* user defined callback */
  DockletDatum *datum;	/* information passed to the user defined callback */

  GtkWidget *window;	/* application window instance */
  GtkWidget *layout;	/* application window internal layout */
  GtkWidget *inside;	/* application window internals */
  GdkPixbuf *render;	/* off screen pixbuf contents */

  gulong buttonHandler;	/* tag identifing the button-press-event callback */
  gulong windowHandler;	/* tag identifing the configure-event callback */
  gboolean moved;	/* used to flag position change */

  GtkOrientation place;	/* GTK_ORIENTATION of text */
  GtkVisibility visa;	/* governs using a frame layout */

  gint width, height;	/* application window dimensions */
  gint xpos, ypos;	/* application window position */

  const gchar *icon;    /* docklet icon image file */
  const gchar *text;    /* docklet text next to image */
  const gchar *font;    /* font description (ex: "Luxi Mono 12") */

  GdkColor *fg;		/* foreground color */
  GdkColor *bg;		/* background color */
};

struct _DockletClass
{
  GtkObjectClass parent; /* DockletClass inherits from GtkObjectClass */
};

struct _DockletDatum
{
  Docklet  *self;	 /* unique instance of a Docklet class */
  GdkEvent *event;	 /* union of events (see, gdk/gdkevents.h) */
  gpointer user;	 /* optional user provided data */
};

/* Methods exported in the implementation */
GType docklet_get_type (void);

Docklet *docklet_new (GdkWindowTypeHint hint,
                      gint width, gint height,
                      gint xpos, gint ypos,
                      GtkOrientation place,
                      GtkVisibility visa,
                      const gchar *icon,
                      const gchar *text,
                      const gchar *font,
                      GdkColor *fg,
                      GdkColor *bg);

void docklet_update (Docklet *instance, const gchar *icon, const gchar *text);
void docklet_set_cursor (Docklet *instance, GdkCursorType cursor);

void docklet_set_callback (Docklet *instance,
                           GtkFunction callback,
                           gpointer data);

G_END_DECLS

#endif /* </DOCKLET_H */
