/*-
 *
 * This plugin was written by Andrew Sampson for the Golem window manager,
 * using code from the fspanel application and the Golem pager plugin 
 * 
 * Portions Copyright (c) 2000-2001 Peter Zelezny	(fspanel)
 * Portions Copyright (c) 2001 Jordan DeLong		(pager plugin)
 *
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the author nor the names of contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */
#ifndef _TASKBAR_H
#define _TASKBAR_H

#define ICONWIDTH 16
#define ICONHEIGHT 16
#define TASKBAR_HEIGHT		24
#define TASKBAR_WIDTH (scr_width)
#define TEXTPAD 6
#define GRILL_WIDTH 12
#define MAX_TASK_WIDTH 145
#define FONT_NAME "-*-lucida*-m*-r-*-*-12-*-*"


#define HAVE_XPM



/* a task */
typedef struct task
{
	struct task *next;
	struct task *prev;
	client_t	*client;	/* client we represent */
	Pixmap icon;
	Pixmap mask;
	char *name;
	int pos_x;
	int width;
	unsigned int focused:1;
	unsigned int iconified:1;
	unsigned int icon_copied:1;
}
task;

/* a taskbar */
typedef struct {
	GC		fore_gc;
	Window		win;		/* the taskbar window */
	client_t	*client;	/* this taskbar's client structure (we are managed) */

	task *task_list;		/* our list of tasks */
	int num_tasks;
        int hidden;
        int at_top;
        int bottom_position;		/* we'll save the bottom screen position here */
        				/* (top screen posit. is always 0) */

} taskbar_t;

/* the global taskbar struct */
struct taskbar_global {
	GC		drawgc;		/* graphics context for this scr */
	taskbar_t	*tb;		/* taskbar */
	Pixel		grid_color;	/* color to use for grid drawing */
	Pixel		sel_color;	/* color for the selected portion of the grid */
};

extern struct taskbar_global *tb_global;
extern int scr_width;
extern int scr_depth;
extern XFontStruct *xfs;
extern int text_y;

extern Pixmap generic_icon;
extern Pixmap generic_mask;

extern unsigned short cols[];
extern unsigned long palette[];


void taskbar_initialize( int position, int show_icons ) ;
taskbar_t *taskbar_create(plugin_t *plugin, screen_t *screen, desktop_t *desktop);
void taskbar_delete(taskbar_t *taskbar);
task *taskbar_findtask(taskbar_t *taskbar, client_t *client);
void taskbar_addtask(plugin_t *plugin, taskbar_t *taskbar, client_t *client);
void taskbar_rmtask(taskbar_t *taskbar, task *tk, client_t *client);
void taskbar_click(taskbar_t *taskbar, int x, int y);
void taskbar_expose(taskbar_t *taskbar, GC gc, XExposeEvent *e);
void taskbar_client_propertynotify( taskbar_t *tb, task *tk,
                                    client_t *client ) ;

void set_foreground ( taskbar_t *tb, int index);
void draw_line (taskbar_t *tb, int x, int y, int a, int b);
void fill_rect (taskbar_t *tb, int x, int y, int a, int b);
void gui_draw_vline (taskbar_t * tb, int x);
void gui_draw_task (taskbar_t * tb, task * tk);
void move_taskbar (taskbar_t * tb);
void draw_dot (taskbar_t *tb, int x, int y);
void draw_grill (taskbar_t *tb, int x);




#endif
