
static char MicroPage_id[] = "$Header: /usr/tiburon/unix/gui/tmacs/RCS/MicroPage.cc,v 1.4 1997/05/30 16:27:08 oreilly Exp $";

/*
$Log: MicroPage.cc,v $
Revision 1.4  1997/05/30 16:27:08  oreilly
*** empty log message ***

Revision 1.3  97/04/30  19:37:18  19:37:18  oreilly (Thomas C. O'Reilly)
*** empty log message ***

Revision 1.2  97/03/20  12:30:10  12:30:10  oreilly (Thomas C. O'Reilly)
..

Revision 1.1  96/10/28  09:12:19  09:12:19  oreilly (Thomas C. O'Reilly)
Initial revision

*/
#include <Xm/Form.h>
#include <Xm/PushB.h>
#include <Xm/Separator.h>
#include "MicroPage.h"
#include "TiburonApp.h"
#include "ViewButtons.h"
#include "MicroEnvironment.h"
#include "MicroSelect.h"

MicroPage::MicroPage(const char *name, Widget parent)
  : VkComponent(name)
{
  _baseWidget = XtVaCreateWidget(name, xmFormWidgetClass, parent, NULL);
  installDestroyHandler();

  ViewButtons *viewButtons = new ViewButtons("views", _baseWidget);

  XtVaSetValues(viewButtons->baseWidget(),
		XmNorientation, XmHORIZONTAL,
		XmNtopAttachment, XmATTACH_FORM,
		XmNleftAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_FORM,
		NULL);
  
  Layout *layout = new Layout();
  Widget viewButton;
  View *view;
  char errorBuf[errorMsgSize];
  
  view = new View("h2OTempTableView", _baseWidget);
  XtVaSetValues(view->baseWidget(),
		XmNtopAttachment, XmATTACH_WIDGET,
		XmNtopWidget, viewButtons->baseWidget(),
		XmNbottomAttachment, XmATTACH_FORM,
		XmNleftAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_FORM,
		NULL);
      
  viewButton = viewButtons->addView(view);
  
  MicroH2OTempTable *h2OTempTable =
    new MicroH2OTempTable("h2OTempTable", view->baseWidget(), 1000);

  if (h2OTempTable->error())
  {
    h2OTempTable->errorMsg(errorBuf);
    setError(errorBuf);
    return;
  }
  
  layout->reset();
  layout->attachToEdge(Top);
  layout->attachToEdge(Bottom);
  layout->attachToEdge(Left);
  layout->attachToEdge(Right);
  view->add(h2OTempTable->baseWidget(), layout);
  h2OTempTable->show();

  view = new View("gfTableView", _baseWidget);
  XtVaSetValues(view->baseWidget(),
		XmNtopAttachment, XmATTACH_WIDGET,
		XmNtopWidget, viewButtons->baseWidget(),
		XmNbottomAttachment, XmATTACH_FORM,
		XmNleftAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_FORM,
		NULL);
      
  viewButton = viewButtons->addView(view);


  MicroGf5vTable *gf5vTable = 
    new MicroGf5vTable("gf5vTable", view->baseWidget(), 1000);
  
  if (gf5vTable->error())
  {
    gf5vTable->errorMsg(errorBuf);
    setError(errorBuf);
    return;
  }
  layout->reset();
  layout->attachToEdge(Top);
  layout->position(Bottom, 50);
  layout->attachToEdge(Left);
  layout->attachToEdge(Right);
  view->add(gf5vTable->baseWidget(), layout);
  gf5vTable->show();

  MicroGfTable *gfTable = 
    new MicroGfTable("gfTable", view->baseWidget(), 1000);
  
  if (gfTable->error())
  {
    gfTable->errorMsg(errorBuf);
    setError(errorBuf);
    return;
  }
  layout->reset();
  layout->position(Top, 50);
  layout->attachToEdge(Bottom);
  layout->attachToEdge(Left);
  layout->attachToEdge(Right);
  view->add(gfTable->baseWidget(), layout);
  gfTable->show();

  view = new View("microSelectView", _baseWidget);
  XtVaSetValues(view->baseWidget(),
		XmNtopAttachment, XmATTACH_WIDGET,
		XmNtopWidget, viewButtons->baseWidget(),
		XmNbottomAttachment, XmATTACH_FORM,
		XmNleftAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_FORM,
		NULL);
      
  viewButton = viewButtons->addView(view);
  
  MicroSelect *microSelect = 
    new MicroSelect("microSelect", view->baseWidget());
  
  layout->reset();
  layout->attachToEdge(Top);
  layout->attachToEdge(Bottom);
  layout->attachToEdge(Left);
  layout->attachToEdge(Right);
  view->add(microSelect->baseWidget(), layout);
  microSelect->show();
  
  viewButtons->setValue(0, True);
  viewButtons->show();
}


MicroPage::~MicroPage()
{
}
