Пример #1
0
KVFileDialog::KVFileDialog(const TGWindow *p, const TGWindow *main,
                           EKVFileDialogMode dlg_type, TGFileInfo *file_info) :
   TGTransientFrame(p, main, 10, 10, kVerticalFrame)
{
   // Create a file selection dialog. Depending on the dlg_type it can be
   // used for opening or saving a file or selecting a directory.

   fDlgMode=dlg_type;
   SetCleanup(kDeepCleanup);
   Connect("CloseWindow()", "KVFileDialog", this, "CloseWindow()");
   DontCallClose();

   int i;

   if (!p && !main) {
      MakeZombie();
      return;
   }
   if (!file_info) {
      Error("KVFileDialog", "file_info argument not set");
      fFileInfo = &gInfo;
      if (fFileInfo->fIniDir) {
         delete [] fFileInfo->fIniDir;
         fFileInfo->fIniDir = 0;
      }
      if (fFileInfo->fFilename) {
         delete [] fFileInfo->fFilename;
         fFileInfo->fFilename = 0;
      }
      fFileInfo->fFileTypeIdx = 0;
   } else
      fFileInfo = file_info;

   if (!fFileInfo->fFileTypes)
      fFileInfo->fFileTypes = gDefTypes;

   if (!fFileInfo->fIniDir)
      fFileInfo->fIniDir = StrDup(".");

   TGHorizontalFrame *fHtop = new TGHorizontalFrame(this, 10, 10);
   
   //--- top toolbar elements
   TGLabel *fLookin = new TGLabel(fHtop, new TGHotString((dlg_type == kKVFDSave)
                                                  ? "S&ave in:" : "&Look in:"));
   fTreeLB = new TGFSComboBox(fHtop, kIDF_FSLB);
   fTreeLB->Associate(this);

   fPcdup = fClient->GetPicture("tb_uplevel.xpm");
   fPnewf = fClient->GetPicture("tb_newfolder.xpm");
   fPlist = fClient->GetPicture("tb_list.xpm");
   fPdetails = fClient->GetPicture("tb_details.xpm");

   if (!(fPcdup && fPnewf && fPlist && fPdetails))
      Error("KVFileDialog", "missing toolbar pixmap(s).\n");

   fCdup    = new TGPictureButton(fHtop, fPcdup, kIDF_CDUP);
   fNewf    = new TGPictureButton(fHtop, fPnewf, kIDF_NEW_FOLDER);
   fList    = new TGPictureButton(fHtop, fPlist, kIDF_LIST);
   fDetails = new TGPictureButton(fHtop, fPdetails, kIDF_DETAILS);

   fCdup->SetStyle(gClient->GetStyle());
   fNewf->SetStyle(gClient->GetStyle());
   fList->SetStyle(gClient->GetStyle());
   fDetails->SetStyle(gClient->GetStyle());

   fCdup->SetToolTipText("Up One Level");
   fNewf->SetToolTipText("Create New Folder");
   fList->SetToolTipText("List");
   fDetails->SetToolTipText("Details");

   fCdup->Associate(this);
   fNewf->Associate(this);
   fList->Associate(this);
   fDetails->Associate(this);

   fList->AllowStayDown(kTRUE);
   fDetails->AllowStayDown(kTRUE);

   fTreeLB->Resize(200, fTreeLB->GetDefaultHeight());

   fHtop->AddFrame(fLookin, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
   fHtop->AddFrame(fTreeLB, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 3, 0, 2, 2));
   fHtop->AddFrame(fCdup, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
   fHtop->AddFrame(fNewf, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
   fHtop->AddFrame(fList, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
   fHtop->AddFrame(fDetails, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 8, 2, 2));

   if (dlg_type == kKVFDSave) {
      fCheckB = new TGCheckButton(fHtop, "&Overwrite", kIDF_CHECKB);
      fCheckB->SetToolTipText("Overwrite a file without displaying a message if selected");
   } else {
      fCheckB = new TGCheckButton(fHtop, "&Multiple files", kIDF_CHECKB);
      fCheckB->SetToolTipText("Allows multiple file selection when SHIFT is pressed");
      fCheckB->Connect("Toggled(Bool_t)","TGFileInfo",fFileInfo,"SetMultipleSelection(Bool_t)");
   }
   fHtop->AddFrame(fCheckB, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
   fCheckB->SetOn(fFileInfo->fMultipleSelection);
   AddFrame(fHtop, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));

   //--- file view

   fFv = new TGListView(this, 400, 161);

   fFc = new TGFileContainer(fFv->GetViewPort(),
                             10, 10, kHorizontalFrame, fgWhitePixel);
   fFc->Associate(this);

   fFv->GetViewPort()->SetBackgroundColor(fgWhitePixel);
   fFv->SetContainer(fFc);
   fFv->SetViewMode(kLVList);
   fFv->SetIncrements(1, 19); // set vertical scroll one line height at a time

   TGTextButton** buttons = fFv->GetHeaderButtons();
   if (buttons) {
      buttons[0]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByName)");
      buttons[1]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByType)");
      buttons[2]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortBySize)");
      buttons[3]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByOwner)");
      buttons[4]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByGroup)");
      buttons[5]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByDate)");
   }

   fFc->SetFilter(fFileInfo->fFileTypes[fFileInfo->fFileTypeIdx+1]);
   fFc->Sort(kSortByName);
   fFc->ChangeDirectory(fFileInfo->fIniDir);
   fFc->SetMultipleSelection(fFileInfo->fMultipleSelection);
   fTreeLB->Update(fFc->GetDirectory());

   fList->SetState(kButtonEngaged);

   AddFrame(fFv, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 4, 4, 3, 1));

   if (dlg_type == kKVFDOpen) {
      fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"SetMultipleSelection(Bool_t)");
      fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"UnSelectAll()");
   }
   
   //--- file name and types

   TGHorizontalFrame *fHf = new TGHorizontalFrame(this, 10, 10);

   TGVerticalFrame *fVf = new TGVerticalFrame(fHf, 10, 10);

   TGHorizontalFrame *fHfname = new TGHorizontalFrame(fVf, 10, 10);

   TGLabel *fLfname = new TGLabel(fHfname, new TGHotString("File &name:"));
   fTbfname = new TGTextBuffer(1034);
   fName = new TGTextEntry(fHfname, fTbfname);
   fName->Resize(230, fName->GetDefaultHeight());
   fName->Associate(this);

   fHfname->AddFrame(fLfname, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
   fHfname->AddFrame(fName, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));

   fVf->AddFrame(fHfname, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX));

   TGHorizontalFrame *fHftype = new TGHorizontalFrame(fVf, 10, 10);

   TGLabel *fLftypes = new TGLabel(fHftype, new TGHotString("Files of &type:"));
   fTypes = new TGComboBox(fHftype, kIDF_FTYPESLB);
   fTypes->Associate(this);
   fTypes->Resize(230, fName->GetDefaultHeight());

   TString s;
   for (i = 0; fFileInfo->fFileTypes[i] != 0; i += 2) {
      s.Form("%s (%s)", fFileInfo->fFileTypes[i], fFileInfo->fFileTypes[i+1]);
      fTypes->AddEntry(s.Data(), i);
   }
   fTypes->Select(fFileInfo->fFileTypeIdx);

   // Show all items in combobox without scrollbar
   //TGDimension fw = fTypes->GetListBox()->GetContainer()->GetDefaultSize();
   //fTypes->GetListBox()->Resize(fw.fWidth, fw.fHeight);

   if (fFileInfo->fFilename && fFileInfo->fFilename[0])
      fTbfname->AddText(0, fFileInfo->fFilename);
   else
      fTbfname->Clear();

   fTypes->GetListBox()->Resize(230, 120);
   fHftype->AddFrame(fLftypes, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
   fHftype->AddFrame(fTypes, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));

   fVf->AddFrame(fHftype, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX));

   fHf->AddFrame(fVf, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX));

   //--- Open/Save and Cancel buttons

   TGVerticalFrame *fVbf = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);

   fOk = new TGTextButton(fVbf, new TGHotString((dlg_type == kKVFDSave)
                                                 ? "&Save" : "&Open"), kIDF_OK);
   fCancel = new TGTextButton(fVbf, new TGHotString("Cancel"), kIDF_CANCEL);

   fOk->Associate(this);
   fCancel->Associate(this);

   fVbf->AddFrame(fOk, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
   fVbf->AddFrame(fCancel, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));

   UInt_t width = TMath::Max(fOk->GetDefaultWidth(), fCancel->GetDefaultWidth()) + 20;
   fVbf->Resize(width + 20, fVbf->GetDefaultHeight());

   fHf->AddFrame(fVbf, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));

   AddFrame(fHf, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
   SetEditDisabled(kEditDisable);

   MapSubwindows();

   TGDimension size = GetDefaultSize();

   Resize(size);

   //---- position relative to the parent's window

   CenterOnParent();

   //---- make the message box non-resizable

   SetWMSize(size.fWidth, size.fHeight);
   SetWMSizeHints(size.fWidth, size.fHeight, 10000, 10000, 1, 1);

   const char *wname = ((dlg_type == kKVFDSave) ? "Save As..." : (dlg_type==kKVFDOpen) ? "Open" : "Choose directory...");
   SetWindowName(wname);
   SetIconName(wname);
   SetClassHints("FileDialog", "FileDialog");

   SetMWMHints(kMWMDecorAll | kMWMDecorResizeH  | kMWMDecorMaximize |
                              kMWMDecorMinimize | kMWMDecorMenu,
               kMWMFuncAll |  kMWMFuncResize    | kMWMFuncMaximize |
                              kMWMFuncMinimize,
               kMWMInputModeless);

   MapWindow();
   fFc->DisplayDirectory();
   fClient->WaitFor(this);
}
sis3316_flash::sis3316_flash(const TGWindow *p, UInt_t w, UInt_t h, Bool_t *b) : TGMainFrame(p, w, h)
{
	// use hierarchical cleaning
	SetCleanup(kDeepCleanup);
	if(b){
		fBSetup = b;
		*fBSetup = kTRUE;
	}
	// main window icon and general setup
	SetWindowName("SIS3316 - Flash Programmer");
	SetIconPixmap("sis1.png");

	fClient->GetColorByName("green", this->green);
	fClient->GetColorByName("red", this->red);
	reboot_prevent_flag = 0;

	// vertical frame
	fVert1 = new TGVerticalFrame(this, GetDefaultWidth(), GetDefaultHeight());
	AddFrame(fVert1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));


	// VME FPGA Programming section
	fGrpVME = new TGGroupFrame(fVert1, "VME FPGA Programming");  // hints, left, right, top, bottom
	fVert1->AddFrame(fGrpVME, new TGLayoutHints(kLHintsExpandX, 5, 5, 20, 5));
	
	fLblVMEImg = new TGLabel(fGrpVME, "VME FPGA Image");
	fGrpVME->AddFrame(fLblVMEImg, new TGLayoutHints(kLHintsNormal, 0, 0, 10, 5));
	
	fHor1 = new TGHorizontalFrame(fGrpVME);
	fGrpVME->AddFrame(fHor1, new TGLayoutHints(kLHintsExpandX));

	fVMEImgPath = new TGTextEntry(fHor1, "test VME Image.bin");
	fHor1->AddFrame(fVMEImgPath, new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5));
	fVMEImgPath->SetWidth(240);
	
	fButVMEBrowse = new TGTextButton(fHor1, "...", BTN_VME_BROWSE);
	fButVMEBrowse->ChangeOptions(fButVMEBrowse->GetOptions() | kFixedWidth);
	fButVMEBrowse->SetWidth(50);
	fButVMEBrowse->Associate(this);
	fHor1->AddFrame(fButVMEBrowse, new TGLayoutHints(kLHintsRight, 5, 5, 5, 5));

	fButVMEProg = new TGTextButton(fGrpVME, "Program VME FPGA", BTN_VME_PROG);
	fButVMEProg->Associate(this);
	fGrpVME->AddFrame(fButVMEProg, new TGLayoutHints(kLHintsExpandX, 5, 5, 10, 15));



	// ADC FPGA Programming section
	fGrpADC = new TGGroupFrame(fVert1, "ADC FPGA Programming");
	//fVert1->AddFrame(fGrpADC, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5, 10, 5));
	fVert1->AddFrame(fGrpADC, new TGLayoutHints(kLHintsExpandX, 5, 5, 20, 5));
	
	// ADC1
	fLblADC1Img = new TGLabel(fGrpADC, "ADC FPGA Image");
	fGrpADC->AddFrame(fLblADC1Img, new TGLayoutHints(kLHintsNormal, 0, 0, 10, 5));
	
	fHorADC1 = new TGHorizontalFrame(fGrpADC);
	fGrpADC->AddFrame(fHorADC1, new TGLayoutHints(kLHintsExpandX));

	fADC1ImgPath = new TGTextEntry(fHorADC1, "test ADC Image.bin");
	fHorADC1->AddFrame(fADC1ImgPath, new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5));
	fADC1ImgPath->SetWidth(240);
	
	fButADC1Browse = new TGTextButton(fHorADC1, "...", BTN_ADC1_BROWSE);
	fButADC1Browse->ChangeOptions(fButADC1Browse->GetOptions() | kFixedWidth);
	fButADC1Browse->SetWidth(50);
	fButADC1Browse->Associate(this);
	fHorADC1->AddFrame(fButADC1Browse, new TGLayoutHints(kLHintsRight, 5, 5, 5, 5));

	fButADCProg = new TGTextButton(fGrpADC, "Program ADC FPGAs", BTN_ADC_PROG);
	fGrpADC->AddFrame(fButADCProg, new TGLayoutHints(kLHintsExpandX, 5, 5, 10, 15));
	fButADCProg->Associate(this);

#ifdef NOT_IMPLEMENTED	
	// ADC2
	fLblADC2Img = new TGLabel(fGrpADC, "ADC2 FPGA Image");
	fGrpADC->AddFrame(fLblADC2Img, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));

	fHorADC2 = new TGHorizontalFrame(fGrpADC);
	fGrpADC->AddFrame(fHorADC2, new TGLayoutHints(kLHintsExpandX));

	fADC2ImgPath = new TGTextEntry(fHorADC2, "test ADC2 Image.bin");
	fHorADC2->AddFrame(fADC2ImgPath, new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5));
	fADC2ImgPath->SetWidth(187);

	fButADC2Browse = new TGTextButton(fHorADC2, "...", BTN_ADC2_BROWSE);
	fButADC2Browse->ChangeOptions(fButADC2Browse->GetOptions() | kFixedWidth);
	fButADC2Browse->SetWidth(50);
	fButADC2Browse->Associate(this);
	fHorADC2->AddFrame(fButADC2Browse, new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5));
	
	// ADC3
	fLblADC3Img = new TGLabel(fGrpADC, "ADC3 FPGA Image");
	fGrpADC->AddFrame(fLblADC3Img, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));

	fHorADC3 = new TGHorizontalFrame(fGrpADC);
	fGrpADC->AddFrame(fHorADC3, new TGLayoutHints(kLHintsExpandX));

	fADC3ImgPath = new TGTextEntry(fHorADC3, "test ADC2 Image.bin");
	fHorADC3->AddFrame(fADC3ImgPath, new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5));
	fADC3ImgPath->SetWidth(187);

	fButADC3Browse = new TGTextButton(fHorADC3, "...", BTN_ADC3_BROWSE);
	fButADC3Browse->ChangeOptions(fButADC3Browse->GetOptions() | kFixedWidth);
	fButADC3Browse->SetWidth(50);
	fButADC3Browse->Associate(this);
	fHorADC3->AddFrame(fButADC3Browse, new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5));
	
	// ADC4
	fLblADC4Img = new TGLabel(fGrpADC, "ADC4 FPGA Image");
	fGrpADC->AddFrame(fLblADC4Img, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));

	fHorADC4 = new TGHorizontalFrame(fGrpADC);
	fGrpADC->AddFrame(fHorADC4, new TGLayoutHints(kLHintsExpandX));

	fADC4ImgPath = new TGTextEntry(fHorADC4, "test ADC4 Image.bin");
	fHorADC4->AddFrame(fADC4ImgPath, new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5));
	fADC4ImgPath->SetWidth(187);

	fButADC4Browse = new TGTextButton(fHorADC4, "...", BTN_ADC4_BROWSE);
	fButADC4Browse->ChangeOptions(fButADC4Browse->GetOptions() | kFixedWidth);
	fButADC4Browse->SetWidth(50);
	fButADC4Browse->Associate(this);
	fHorADC4->AddFrame(fButADC4Browse, new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5));
	

	fChkADCImgSelect = new TGCheckButton(fGrpADC, "ADC FPGAs have unique images");
	fChkADCImgSelect->SetState(kButtonDown)   ; // is ON !
	fChkADCImgSelect->SetEnabled(kFALSE); //
	//fChkADCImgSelect->Associate(this);
	fGrpADC->AddFrame(fChkADCImgSelect);

#endif	
	//fGrpProgram = new TGGroupFrame(fVert1, "Programming");
	//fVert1->AddFrame(fGrpProgram, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 10, 10, 0, 0));

	fGrpBarProg = new TGGroupFrame(fVert1, "Programming progress");  // hints, left, right, top, bottom
	fVert1->AddFrame(fGrpBarProg, new TGLayoutHints(kLHintsExpandX, 5, 5, 20, 5));


	fBar_prog = new TGHProgressBar(fGrpBarProg);
	fBar_prog->ShowPosition(kTRUE, kTRUE);
	fBar_prog->SetBarColor("blue");
	fBar_prog->SetForegroundColor(0x000000);
	fGrpBarProg->AddFrame(fBar_prog, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 10, 20, 10)); // hints, left, right, top, bottom


	fGrpBarVerify = new TGGroupFrame(fVert1, "Verifying progress");  // hints, left, right, top, bottom
	fVert1->AddFrame(fGrpBarVerify, new TGLayoutHints(kLHintsExpandX, 5, 5, 20, 5));

	fBar_verify = new TGHProgressBar(fGrpBarVerify);
	fBar_verify->ShowPosition(kTRUE, kTRUE);
	fBar_verify->SetBarColor("blue");
	fBar_verify->SetForegroundColor(0x000000);
	fGrpBarVerify->AddFrame(fBar_verify, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 10, 20, 20)); // hints, left, right, top, bottom

	fGrpReboot = new TGGroupFrame(fVert1, "Reboot");  // hints, left, right, top, bottom
	fVert1->AddFrame(fGrpReboot, new TGLayoutHints(kLHintsExpandX, 5, 5, 20, 5));

	fButReboot = new TGTextButton(fGrpReboot, "Reboot SIS3316 FPGAs", BTN_REBOOT);
	fButReboot->Associate(this);
	fButReboot->ChangeBackground(this->green);
	fGrpReboot->AddFrame(fButReboot, new TGLayoutHints(kLHintsExpandX, 5, 5, 10, 15));



	fLabel_reboot_note = new TGLabel(fGrpReboot,"Note: the watchdog has to be enabled -> SW80-7 ON ");
	fLabel_reboot_note->SetTextJustify(kTextLeft + kTextCenterX );
	fLabel_reboot_note->SetMargins(0,0,0,0);
	fLabel_reboot_note->SetWrapLength(-1);
	fGrpReboot->AddFrame(fLabel_reboot_note, new TGLayoutHints(kLHintsExpandX,2,2,15,2));



	
	// draw everything
	SetWMSizeHints(w, h, w, h, 1, 1);
	Resize(GetDefaultSize());   // resize to default size
	MapSubwindows();
	// initially hidden
#ifdef NOT_IMPLEMENTED	
	fGrpADC->HideFrame(fHorADC2);
	fGrpADC->HideFrame(fHorADC3);
	fGrpADC->HideFrame(fHorADC4);
	fGrpADC->HideFrame(fLblADC2Img);
	fGrpADC->HideFrame(fLblADC3Img);
	fGrpADC->HideFrame(fLblADC4Img);
#endif
	MapWindow();
 
}
Пример #3
0
MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) :
  TGMainFrame(p, w, h)
{
   // Create horizontal splitter
   TGVerticalFrame *fVf = new TGVerticalFrame(this, 10, 10);

   TGHorizontalFrame *fH1 = new TGHorizontalFrame(fVf, 10, 50, kFixedHeight);
   TGHorizontalFrame *fH2 = new TGHorizontalFrame(fVf, 10, 10);
   TGCompositeFrame *fFtop = new TGCompositeFrame(fH1, 10, 10, kSunkenFrame);
   TGCompositeFrame *fFbottom = new TGCompositeFrame(fH2, 10, 10, kSunkenFrame);

   TGLabel *fLtop = new TGLabel(fFtop, "Top Frame");
   TGLabel *fLbottom = new TGLabel(fFbottom, "Bottom Frame");

   fFtop->AddFrame(fLtop, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,
                                            3, 0, 0, 0));
   fFbottom->AddFrame(fLbottom, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,
                                                  3, 0, 0, 0));

   fH1->AddFrame(fFtop, new TGLayoutHints(kLHintsTop | kLHintsExpandY | 
                                          kLHintsExpandX, 0, 0, 1, 2));
   fH2->AddFrame(fFbottom, new TGLayoutHints(kLHintsTop | kLHintsExpandY | 
                                             kLHintsExpandX, 0, 0, 1, 2));

   fH1->Resize(fFtop->GetDefaultWidth(), fH1->GetDefaultHeight()+20);
   fH2->Resize(fFbottom->GetDefaultWidth(), fH2->GetDefaultHeight()+20);
   fVf->AddFrame(fH1, new TGLayoutHints(kLHintsTop | kLHintsExpandX));

   TGHSplitter *hsplitter = new TGHSplitter(fVf,2,2);
   hsplitter->SetFrame(fH1, kTRUE);
   fVf->AddFrame(hsplitter, new TGLayoutHints(kLHintsTop | kLHintsExpandX));

   fVf->AddFrame(fH2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));   
   
   // button frame
   TGVerticalFrame *hframe = new TGVerticalFrame(this, 10, 10);
   TGCompositeFrame *cframe2 = new TGCompositeFrame(hframe, 170, 50, 
                                             kHorizontalFrame | kFixedWidth);
   TGTextButton *save = new TGTextButton(cframe2, "&Save");
   cframe2->AddFrame(save, new TGLayoutHints(kLHintsTop | kLHintsExpandX,
                                             3, 2, 2, 2));
   save->Connect("Clicked()", "MyMainFrame", this, "DoSave()");
   save->SetToolTipText("Click on the button to save the application as C++ macro");
   
   TGTextButton *exit = new TGTextButton(cframe2, "&Exit ","gApplication->Terminate(0)");
   cframe2->AddFrame(exit, new TGLayoutHints(kLHintsTop | kLHintsExpandX,
                                             2, 0, 2, 2));
   hframe->AddFrame(cframe2, new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 1));
   
   AddFrame(fVf, new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY));
   AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 1));
   
   // What to clean up in dtor
   SetCleanup(kDeepCleanup);
     
   // Set a name to the main frame   
   SetWindowName("Horizontal Splitter");
   SetWMSizeHints(300, 250, 600, 600, 0, 0);
   MapSubwindows();
   Resize(GetDefaultSize());
   MapWindow();
}