/*-
 * Copyright (c) 2001 Jordan DeLong
 * 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 TASKLIST_H
#define TASKLIST_H

#include "plugutil.h"

/* some constants */
#define TASKLIST_XBORDER	5
#define TASKLIST_YBORDER	2
#define TASKLIST_MINWIDTH	75

/* possible tasklistent types */
enum
{
	ET_SUBTASKLIST,
	ET_TASK,
   ET_LABEL
};

#define TASKLIST_WIDTH  200
#define TASKLIST_HEIGHT 100


/* positions for addent */
#define POS_LAST	-1

/* an entry on a tasklist */
typedef struct tasklistent
{
	int	type;       /* type of this entry */
	char	*text;		/* text to display */

	/* data that depends on type */
	union
   {
		void	*dat;
		char	*cmd;
		int	subtasklist;
	} dat;
   
} tasklistent_t;

/* structure describing a tasklist */
typedef struct tasklist {
	struct tasklist	*forefather;	/* the root parent of this tasklist tree, can point to this */
	struct tasklist	**active_sub;	/* the currently open subtasklist, if any, per screen */
	client_t	   **client;	/* a client_t for each screen */

	int		   entry_count;	/* tasklist entries */
	tasklistent_t	**entries;

	int		   subtasklist_count;	/* subtasklists, idx's in tasklistent ref them */
	struct tasklist	**subtasklists;
} tasklist_t;

extern XContext tasklist_context;
extern int tasklist_stacklayer;



int tasklist2_init( char *fontname,
                    char *back_colour,
                    char *fore_colour,
                    dgroup_t *dgroup,
                    pixmap_t *bullet);
void tasklist2_shutdown();

tasklist_t *tasklist_create();
tasklistent_t *tasklist_addent(tasklist_t *tasklist, int pos, int type, char *text, void *dat);
void tasklist_freeent(tasklistent_t *ent);
void tasklist_size(tasklist_t *tasklist);
int  tasklist_realize(tasklist_t *tasklist);
void tasklist_delete(tasklist_t *tasklist);
void tasklist_remove(tasklist_t *tasklist, void *key);
void tasklist_expose(tasklist_t *tasklist, client_t *client, XExposeEvent *e);
void tasklist_use(tasklist_t *tasklist, screen_t *screen);
void tasklist_click(tasklist_t *tasklist, client_t *client, XButtonEvent *e);

#include "parseparams.h"

#endif
