#ifndef __XVINTERN_H
#define __XVINTERN_H

class TFontId
{
	wxString m_strFace;
	int m_nSize;
	XVT_FONT_STYLE_MASK m_wMask;
	WINDOW m_win;

protected:
	void Copy(const TFontId& pFont);
	bool IsEqual(const TFontId& pFont) const;

public:
	void SetWin(WINDOW w) { m_win = w; }
	WINDOW Win() const { return m_win; }

	void SetPointSize(int s) { m_nSize = s; }
	int PointSize() const { return m_nSize; }

	void SetMask(XVT_FONT_STYLE_MASK mask) { m_wMask = mask; }
	XVT_FONT_STYLE_MASK Mask() const { return m_wMask; }
	int Style() const;
  bool Underline() const;
  int Weight() const;
	
	void SetFaceName(const char* f) { m_strFace = f; }
	const char* FaceName() const;
	int Family() const;

	void Copy(const wxFont& rFont);
	wxFont& Font(wxDC* dc, WINDOW w) const;
	
	TFontId& operator=(const TFontId& f) { Copy(f); return *this; }
	bool operator==(const TFontId& f) const { return IsEqual(f); }
	bool operator!=(const TFontId& f) const { return !IsEqual(f); }

	TFontId() : m_nSize(0), m_wMask(0), m_win(NULL_WIN)  { }
	TFontId(const TFontId& f) : m_win(NULL_WIN) { Copy(f); }
};

class TDC : public wxObject
{
	wxWindow* _owner;

protected:
  wxDC* _dc;
	RCT _clip;
  int _dirty;  // false = 0, true = 1, very_dirty = -1;
  int _deltaf;

	DRAW_CTOOLS _real_dct;
	TFontId _real_font;

	bool PenChanged() const;
	bool BrushChanged() const;
	bool FontChanged() const;

public:
	DRAW_CTOOLS _dct;
	TFontId _font;
  wxPoint _pnt;

	void SetClippingBox(const RCT* pRct);
	bool GetClippingBox(RCT* pRct) const;
	void SetDirty(int d = 1);
  int GetFontDelta() const { return _deltaf; }

  virtual wxDC& GetDC(bool bPaint = false);
	virtual void KillDC();
  TDC(wxWindow* owner);
	virtual ~TDC();
};

class TPrintDC : public TDC
{
  static bool _page_start;

public:
  static void SetPageStart();

  virtual wxDC& GetDC(bool);
	virtual void KillDC();
	TPrintDC(wxWindow* owner);
	virtual ~TPrintDC();
};

wxString _GetAppTitle();

#endif