//*CMZ : 2.23/02 02/09/99 15.54.28 by Rene Brun
//*CMZ : 2.00/00 24/02/98 16.46.26 by Fons Rademakers
//*-- Author : Fons Rademakers 24/02/98
//*KEEP,CopyRight,T=C.
/*************************************************************************
* Copyright(c) 1995-1999, The ROOT System, All rights reserved. *
* Authors: Rene Brun and Fons Rademakers. *
* *
* For the licensing terms see $ROOTSYS/AA_LICENSE. *
* For the list of contributors see $ROOTSYS/AA_CREDITS. *
*************************************************************************/
//*KEND.
//////////////////////////////////////////////////////////////////////////
// //
// TRootHelpDialog //
// //
// A TRootHelpDialog is used to display help text (or any text in a //
// dialog window). There is on OK button to popdown the dialog. //
// //
//////////////////////////////////////////////////////////////////////////
//*KEEP,TRootHelpDialog,T=C++.
#include "TRootHelpDialog.h"
//*KEEP,TGButton.
#include "TGButton.h"
//*KEEP,TGTextView.
#include "TGTextView.h"
//*KEND.
ClassImp(TRootHelpDialog)
//______________________________________________________________________________
TRootHelpDialog::TRootHelpDialog(const TGWindow *main,
const char *title, UInt_t w, UInt_t h) :
TGTransientFrame(gClient->GetRoot(), main, w, h)
{
// Create a help text dialog.
fView = new TGTextView(this, w, h, kSunkenFrame | kDoubleBorder);
//fView = new TGTextView(this, 10, 10, kSunkenFrame | kDoubleBorder);
fL1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 3, 3, 3, 3);
AddFrame(fView, fL1);
fOK = new TGTextButton(this, " &OK ");
fL2 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5);
AddFrame(fOK, fL2);
SetWindowName(title);
SetIconName(title);
MapSubwindows();
Resize(GetDefaultSize());
// position relative to the parent's window
Window_t wdum;
int ax, ay;
gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
((TGFrame *) main)->GetWidth() - (fWidth >> 1),
(((TGFrame *) main)->GetHeight() - fHeight) >> 1,
ax, ay, wdum);
Move(ax, ay);
SetWMPosition(ax, ay);
}
//______________________________________________________________________________
TRootHelpDialog::~TRootHelpDialog()
{
// Delete help text dialog.
delete fView;
delete fOK;
delete fL1;
delete fL2;
}
//______________________________________________________________________________
void TRootHelpDialog::Popup()
{
// Show help dialog.
MapWindow();
}
//______________________________________________________________________________
void TRootHelpDialog::SetText(const char *helpText)
{
// Set help text from helpText buffer in TGTextView.
fView->LoadBuffer(helpText);
}
//______________________________________________________________________________
void TRootHelpDialog::AddText(const char *helpText)
{
// Add help text from helpText buffer to already existing text in TGTextView.
Warning("AddText", "adding text to help dialog not yet supported");
fView->LoadBuffer(helpText);
}
//______________________________________________________________________________
void TRootHelpDialog::CloseWindow()
{
// Called when closed via window manager action.
delete this;
}
//______________________________________________________________________________
Bool_t TRootHelpDialog::ProcessMessage(Long_t, Long_t, Long_t)
{
// Process OK button.
// Only one button and one action...
delete this;
return kTRUE;
}
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.