// ter_mfc.h : header file
//

#ifndef TER_MFC_H
#define TER_MFC_H

#include "ter.h"
#include "ter_cmd.h"

/////////////////////////////////////////////////////////////////////////////
// CTer window

class CTer : public CWnd
{
    DECLARE_DYNCREATE(CTer)

// Construction
public:
    CTer();
    virtual BOOL Create(DWORD, const RECT &, CWnd *, UINT);

// Attributes
public:
    virtual DWORD DefaultEditStyles(); // return edit style constants (TER_)
    BOOL          MenuEnable(int);     // TRUE if menu item should be enabled
    int           MenuSelect(int);     // 0=unchecked, 1=checked

// Operations
public:
    virtual     ~CTer();
    virtual void DeleteContents();
    HGLOBAL      GetHandle(int *);
    BOOL         SetHandle(HGLOBAL,int,LPSTR,BOOL);
    void         SerializeRaw(CArchive &ar);
    virtual void Serialize(CArchive &ar);
    void         ReadArchive(CArchive &ar, DWORD len);
    void         WriteArchive(CArchive &ar);
    void         Cut();
    void         Copy();
    void         Paste();
    BOOL         CanUndo();
    BOOL         Undo();
    void         GetSel(int &StartPos,int &EndPos);
    void         Clear();
    BOOL         GetModify();
    void         SetModify(BOOL bModified=TRUE);
    int         GetLineCount();
    int         LineIndex(int nLine=-1);
    BOOL         SetReadOnly(BOOL bReadOnly=TRUE);
    int          GetLine(int index, LPSTR buffer);
    int          GetLine(int index, LPSTR buffer, int MaxLength);
    int         GetFirstVisibleLine();
    int         LineFromChar(int nIndex=-1);
    int          LineLength(int nLine=-1);
    void         LineScroll(int nLines, int nChars=0);
    void         ReplaceSel(char *NewText);
    void         SetSel(int nStartChar, int nEndChar, BOOL bNoScroll=FALSE);

// Construction
protected:
    LRESULT      TerWindowProc(UINT,WPARAM,LPARAM);
    void         TerMenu(WPARAM);
    WNDPROC      *GetSuperWndProcAddr();

// Implementation
public:

protected:
    HGLOBAL      m_hBuffer;   // handle to the retrieved buffer
    DWORD        m_BufLen;    // buffer length

    DWORD        GetBuffer(); // retrieve the text buffer

// Generated message map functions
protected:
        //{{AFX_MSG(CTer)
                // NOTE - the ClassWizard will add and remove member functions here.
        //}}AFX_MSG
        
        DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////
#endif

