#ifndef CODE_GFXCOMMAND_CXX
#define CODE_GFXCOMMAND_CXX

/*-----------------------------------------------------------------------
 * Xclasses code file
 * ($Id: gfx_command.cxx,v 1.1.1.1 1998/07/16 19:29:31 cvs 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 "types.h"
#include <Xclasses/gfx_command.h>
#include <Xclasses/gadget.h>
#include <Xclasses/Xcolors.h>

gfx_command::gfx_command() : gfx_object()
{
	Name("gfx_command");
}
gfx_command::~gfx_command()
{
}

static void draw(class gfx_command *o,class gadget *g,int x,int y,int w,int h,int c)
{
#define PTS1C	5
#define PTS2C	5
	XPoint pts1[PTS1C]={{x+1,y+3},
						{0,h-4},{w-3,0},
						{0,-(h-5)},{-(w-3),-2}
						};

	XPoint pts2[PTS2C]={{x+1+w-3,y+3},{-2,-3},{-2,0},{-2,3},{6,0}};
	XSetForeground(o->display(),g->gg_gc(),o->col_white());
//  shape: Complex, Convex, or Nonconvex
	XFillPolygon(o->display(),g->gg_win(),g->gg_gc(),pts1,PTS1C,Convex,CoordModePrevious);
	XSetForeground(o->display(),g->gg_gc(),c);
	XDrawLines(o->display(),g->gg_win(),g->gg_gc(),pts1,PTS1C,CoordModePrevious);
	XDrawLines(o->display(),g->gg_win(),g->gg_gc(),pts2,PTS2C,CoordModePrevious);
}

void gfx_command::Adjust(int a)
{
//	p->adjust=a;
}
void gfx_command::draw_normal(class gadget *g,int x,int y,int w,int h)
{
	draw(this,g,x,y,w,h,col_text());
}
void gfx_command::draw_selected(class gadget *g,int x,int y,int w,int h)
{
	draw(this,g,x+1,y+1,w,h,col_selectedtext());
}
void gfx_command::draw_locked(class gadget *g,int x,int y,int w,int h)
{
	draw(this,g,x,y,w,h,col_text());
}
void gfx_command::draw_selectedlocked(class gadget *g,int x,int y,int w,int h)
{
	draw(this,g,x+1,y+1,w,h,col_selectedtext());
}

int gfx_command::height(class gadget *g)
{
	return NOLIMIT;
}
int gfx_command::width(class gadget *g)
{
	return NOLIMIT;
}

#endif
