#ifndef _TEXTDISPLAY_H
#define _TEXTDISPLAY_H

#include "display.h"
#include "list.h"

typedef enum {NEWLINE, TAB} TextCode;

class TextDisplay : public WDisplay {
public:
  TextDisplay(int width, int height);
  TextDisplay &WriteStr(char *str);
  TextDisplay &WriteStr(char *str, int width);
  TextDisplay &WriteInt(int i);
  TextDisplay &HyperStr(char *str, void (*callback)(void *), void *ret_data);
  TextDisplay &DrawPixmap(CPixmap *handle, int owner = -1);
  TextDisplay &NewLine();
  TextDisplay &Tab();
  TextDisplay &VSpace(int size);
  TextDisplay &HSpace(int size);
  TextDisplay &SetTabs(int t1, int t2= -1, int t3= -1, int t4= -1, int t5= -1);
  TextDisplay &operator << (char *text) {return WriteStr(text);}
  TextDisplay &operator << (int i) {return WriteInt(i);}
  TextDisplay &operator << (TextCode code);
  
  ScreenCoord TranslateScreen(MapCoord c);
  void Update();
  void GetEvent(EventType event, int x, int y, char *data);
protected:
  virtual void CreateButtons();
  virtual void Setup();
private:
  int tabs[5];
  int lineHeight;
  int x, y;
  int width, height;
  List<struct link *> links;
};

#endif
