#ifndef _TEXTLINE_H
#define _TEXTLINE_H

class _textline
{
	bool focused;
	bool enter_clears;
	bool insert;            // true if insert, false if overwrite
	int color;
	int caret;              // tracks the text caret
	int limit;
	int x, y, w, h, offset;
	string edittext;        // the string being edited
	string::iterator iter;  // string iterator
public:
	
	_textline() :
		focused (true),
		enter_clears (true),
		insert (true),
		color (makecol(255, 255, 255)),
		caret (0),
		limit (0),
		x (0),
		y (0),
		w (0),
		h (0),
		offset (0),
		edittext (""),
		iter (string::iterator())
	{}
	
	bool mouseclicked();
	void enable();
	void disable();
	
	void init(int _x, int _y, int _w, int _h, bool _enter_clears, int charlimit = 0);
	void reset();
	void draw(float bgalpha = 0.7);
	void set_text(string text);
	void set_color(int color);
	string check(float bgalpha = 0.7);  //only returns something other than "/NOTHING YET/" if (enter_clears) and the user hits enter
	string current_text() const;
};

#endif
