/*-
 * Copyright (c) 2001
 * Tatsuya Kudoh(CDR/TK),ROYALPANDA.    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.
 *
 * 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 _KSDRAW_H_
#define _KSDRAW_H_

#include"kskernel.h"

#define KS_PLT_NONE		(12 << 9)
#define KS_PLT_KEYBOARD		(8 << 9)
#define KS_PLT_KEYBOARD_SHADOW	(9 << 9)
#define KS_PLT_FLOAT		(10 << 9)
#define KS_PLT_WINDOW		(11 << 9)

#define KS_PLT_CURSOR		(15 << 9)

#define KS_PLT_NORMAL		(0 << 9)
#define KS_PLT_REVERSE		(1 << 9)
#define KS_PLT_EMPH		(2 << 9)
#define KS_PLT_GRAY		(3 << 9)

#define KS_FONT_NONE		0
#define KS_FONT_WINDOW		1
#define KS_FONT_KEYBOARD	(KS_FONT_WINDOW+3)
#define KS_FONT_SUBKEYBOARD	(KS_FONT_KEYBOARD+324)
#define KS_FONT_FLOAT		(KS_FONT_SUBKEYBOARD+40)
#define KS_FONT_CONSOLE		(KS_FONT_FLOAT+32)
#define KS_FONT_		(KS_FONT_CONSOLE+40)

#define KS_FONT_CURSOR		511

#define KS_SPR_CURSOR	0
#define KS_SPR_FLOAT	1

typedef struct KSWindow{
	struct KSWindow *next;
	int priority;
	int x;
	int y;
	int width;
	int height;
	int mapped;
	int (*receiver)(KSMsg *msg);
	void *call_data;
}KSWindow;
	

void KSDrawInitialize( void );
void KSSetFontData( int face, int font, unsigned code );
void KSRegistWindow( KSWindow *w );
void KSUnregistWindow( KSWindow *w );
void KSMapWindow( KSWindow *w );
void KSUnmapWindow( KSWindow *w );
void KSDrawCharacter( KSWindow *win, int x, int y, unsigned code, unsigned plt );
void KSDrawWindowBorder( KSWindow *win );
void KSClearWindow( KSWindow *win, unsigned plt );
void KSClearArea( KSWindow *win, int x, int y, int width, int height, unsigned plt );
void KSEnableCursor(int enable);
void KSMoveCursor( int x, int y );
int KSGetCursorStatus( int *x_ret, int *y_ret );
void KSBlinkCursor( void );

#endif
