//=======================================================================
//@V@:Note: This file generated by vgen V1.00 (14:06:08 08 Aug 1996).
//	vtcnv.cpp:	Source for testTextCanvasPane class
//=======================================================================

#include <v/vutil.h>
#include <v/vpopmenu.h>
#include "vtcanvas.h"
#include "vtcmdwin.h"

//=================>>> testTextCanvasPane::testTextCanvasPane <<<================
  testTextCanvasPane::testTextCanvasPane(testCmdWindow* cw)
  {
    _myCmdw = cw;
  }

//=================>>> testTextCanvasPane::~testTextCanvasPane <<<================
  testTextCanvasPane::~testTextCanvasPane()
  {
  }

//=====================>>> testTextCanvasPane::HPage <<<========================
  void testTextCanvasPane::HPage(int shown, int top)
  {
    vTextCanvasPane::HPage(shown, top);
    _myCmdw->SetShownTop(shown,top);
  }

//=====================>>> testTextCanvasPane::VPage <<<========================
  void testTextCanvasPane::VPage(int shown, int top)
  {
    vTextCanvasPane::VPage(shown, top);
    _myCmdw->SetShownTop(shown,top);
  }

//====================>>> testTextCanvasPane::HScroll <<<======================
  void testTextCanvasPane::HScroll(int step)
  {
    int shown,top;
    (void) GetHScroll(shown,top);
    if (step > 0 && top < 100)
	SetHScroll(shown,++top);
    else if (step < 0 && top > 0)
	SetHScroll(shown,--top);
    _myCmdw->SetShownTop(shown,top);
  }

//====================>>> testTextCanvasPane::VScroll <<<======================
  void testTextCanvasPane::VScroll(int step)
  {
    int shown,top;
    (void) GetVScroll(shown,top);
    if (step > 0 && top < 100)
	SetVScroll(shown,++top);
    else if (step < 0 && top > 0)
	SetVScroll(shown,--top);
    _myCmdw->SetShownTop(shown,top);
  }

//===================>>> testTextCanvasPane::FontChanged <<<==================
  void testTextCanvasPane::FontChanged(VCONST vFont& newFont)
  {
    vTextCanvasPane::FontChanged(newFont);
  }

//===================>>> testTextCanvasPane::TextMouseDown <<<==================
  void testTextCanvasPane::TextMouseDown(int row, int col, int button)
  {
    vMenu FileMenu[] =
      {
        {"&New", M_New, isSens, notChk, noKeyLbl, noKey, noSub},
        {"&Open", M_Open, isSens, notChk, noKeyLbl, noKey, noSub},
        {"&Save", M_Save, notSens, notChk, noKeyLbl, noKey, noSub},
	{"Save &As", M_SaveAs, isSens, notChk, noKeyLbl, noKey, noSub},
#ifdef vDEBUG
        {"-", M_Line, notSens, notChk, noKeyLbl, noKey, noSub},
        {"&Debug", M_SetDebug, isSens, notChk, noKeyLbl, noKey, noSub},
#endif
        {"-", M_Line, notSens, notChk, noKeyLbl, noKey, noSub},
        {"&Close",M_Close, isSens, notChk, noKeyLbl, noKey, noSub},
        {"E&xit", M_Exit, isSens, notChk, noKeyLbl, noKey, noSub},
        {NULL}
      };

    if (button == 3)               // check for right button
      {
	vPopupMenu pm(FileMenu,GetPaneParent());  // define the popup
	if (pm.isImplemented())
	    (void) pm.ShowMenu(ColToX(col), RowToY(row));
	else
	  {
	    vBeep();
	  }
      }
    else                           // default action otherwise
	vTextCanvasPane::TextMouseDown(row,col,button);
  }

//======================>>> testTextCanvasPane::TextMouseUp <<<==================
  void testTextCanvasPane::TextMouseUp(int row, int col, int button)
  {
    vTextCanvasPane::TextMouseUp(row,col,button);
  }

//======================>>> testTextCanvasPane::TextMouseMove <<<=================
  void testTextCanvasPane::TextMouseMove(int row, int col, int button)
  {
    vTextCanvasPane::TextMouseMove(row,col,button);
  }

//=========================>>> testTextCanvasPane::Redraw <<<======================
  void testTextCanvasPane::Redraw(int x, int y, int w, int h)
  {
    vTextCanvasPane::Redraw(x,y,w,h);
  }

//======================>>> testTextCanvasPane::ResizeText <<<======================
  void testTextCanvasPane::ResizeText(const int rows, const int cols)
  {
    static int first = 1;
    if (first)
      {
	first = 0;
	vColor test;
	int bits = test.BitsOfColor();
	char bitstr[10];
	IntToStr(bits,bitstr);
	DrawText("Display Bits of Color: "); DrawText(bitstr);
        DrawText(" -  Text Canvas Size: ");
        IntToStr(rows,bitstr) ; DrawText(bitstr); DrawText(",");
        IntToStr(cols,bitstr) ; DrawText(bitstr);
	DrawText("\n\n");
      }
//    else
//	DrawText("Resize Event\n");
    vTextCanvasPane::ResizeText(rows,cols);
  }
