#ifndef CODE_SCROLLERP_H
#define CODE_SCROLLERP_H

/*-----------------------------------------------------------------------
 * Xclasses header file
 * ($Id: scroller_p.h,v 1.2 1998/08/07 19:11:28 schmitzj Exp $)
 * 
 * Copyright (C) 1998 Jürgen Schmitz
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 *-----------------------------------------------------------------------
 */

#include <Xclasses/Xdisplay.h>
#include <Xclasses/scroller.h>
#include <Xclasses/go_button.h>
#include <Xclasses/gfx_arrow.h>


#define BUTH		15
#define SP_BUTS		(buts?BUTH+BUTH:0)
#define S_BUTS		(p->buts?BUTH+BUTH:0)
#define S_BUTSX		(p->buts&&p->horiz&&p->emboss!=irix?(p->edgebuts?BUTH:BUTH+BUTH):0)
#define S_BUTSY		(p->buts&&!p->horiz&&p->emboss!=irix?(p->edgebuts?BUTH:BUTH+BUTH):0)
#define SP_BUTSX	(buts&&horiz?BUTH+BUTH:0)
#define SP_BUTSY	(buts&&!horiz?BUTH+BUTH:0)
#define SP_BUTSX2	(buts&&horiz?(edgebuts?BUTH:BUTH+BUTH):0)
#define SP_BUTSY2	(buts&&!horiz?(edgebuts?BUTH:BUTH+BUTH):0)
#define S_BUTS0X	(p->horiz&&p->buts&&p->edgebuts&&(p->emboss==pOS)?BUTH:0)
#define S_BUTS0Y	(!p->horiz&&p->buts&&p->edgebuts&&(p->emboss==pOS)?BUTH:0)
#define S_BUTS1X	(p->horiz?BUTH:0)
#define S_BUTS1Y	(!p->horiz?BUTH:0)
#define BUTEMBOSS	(p->emboss==irix?RealSize():(p->emboss==pOS?0:RealSize()))

#define S_LENGTH	(p->horiz?width-(RealSize()*2)-S_BUTS:height-(RealSize()*2)-S_BUTS)
#define SP_LENGTH	(horiz?o->width-(o->RealSize()*2)-SP_BUTS:o->height-(o->RealSize()*2)-SP_BUTS)
#define S_X1		(horiz?o->RealSize()+p_pos:o->width-(o->RealSize()*2))
#define S_Y1		(horiz?o->height-(o->RealSize()*2):o->RealSize()+p_pos)
#define S_X2		(horiz?o->RealSize()+p_pos+p_laenge:o->RealSize())
#define S_Y2		(horiz?o->RealSize():o->RealSize()+p_laenge+p_pos)
#define S_X			(horiz?o->RealSize()+p_pos:o->RealSize())
#define S_Y			(horiz?o->RealSize():o->RealSize()+p_pos)
#define S_WIDTH		(horiz?o->RealSize()+p_pos+p_laenge:o->width-o->RealSize())
#define S_HEIGHT	(horiz?o->height-o->RealSize():o->RealSize()+p_laenge+p_pos)
#define S_MAX		(horiz?o->width-o->RealSize()-SP_BUTSX:o->height-o->RealSize()-SP_BUTSY)

class pscroller
{
	friend class scroller;

	class scroller *o;

public:

	int p_laenge;
	int op_laenge;
	int p_pos;
	int op_pos;
	int offset;
	int ticker;

	int anzahl;
	int position;
	int sichtbar;
	int step;

	int horiz:1,
		mmove:1,
		buts:1,
		mtick:3,
		edgebuts:1,
		above:1,
		free:1;

	embosstype	emboss;

	go_button	b1,b2;
	gfx_arrow	a1,a2;

    pscroller();
    ~pscroller();

	void knopf(int m=0);

};

#endif
