/*-----------------------------------------------------------------
LOG
    GEM - Graphics Environment for Multimedia

    A text

    Copyright (c) 1997-1998 Mark Danks. mdanks@cybermed.ucsd.edu
    For information on usage and redistribution, and for a DISCLAIMER OF ALL
    WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.

-----------------------------------------------------------------*/

#ifndef INCLUDE_TEXT_H_
#define INCLUDE_TEXT_H_

#include "Base/GemBase.h"

#include <GL/glx.h>

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    text
    
    Creates a text string

DESCRIPTION

    "font" - The font of the text
    "text" - The text to draw
    "prep" - Prepare all of the XFont characters
  
-----------------------------------------------------------------*/
class text : public GemBase
{
    CPPEXTERN_HEADER(text, GemBase)

    public:

	//////////
	// Constructor
    	text();
    	
    protected:
    	
    	//////////
    	// Destructor
    	virtual ~text();

    	//////////
    	// Do the rendering
    	virtual void 	render(GemState *state);

    	//////////
    	// Create the display lists for the font
    	int 	    	stringCreateList();
    	
    	//////////
    	// Set the text string
    	void	    	textMess(int argc, t_atom *argv);

    	//////////
    	// Prep the display lists
    	void	    	prepMess();

    	//////////
    	static const char *DEFAULT_FONT;

    	//////////
    	// The font to use
    	void	    	fontNameMess(t_symbol *s);

	    //-----------------------------------
	    // GROUP:	Member variables
	    //-----------------------------------
    
    	//////////
    	// If the font display list has to be rebuilt
    	int 	    	m_redoFont;
    	
    	//////////
    	// The font structure
    	XFontStruct 	*m_fontStruct;
    	
    	//////////
    	// The font name
    	char	    	*m_fontName;

    	//////////
    	// The string to display
    	char	    	*m_theString;

    	//////////
    	// The base of the display list
    	int	    		m_fontBase;

    	int 	    	m_windowNumber;
    	
    private:
    	    
    	//////////
    	// Static member functions
    	static void 	textMessCallback(void *data, t_symbol *, int argc, t_atom *argv);
    	static void 	fontNameMessCallback(void *data, t_symbol *s);
    	static void 	prepMessCallback(void *data);
};

#endif	// for header file
