1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // This is a base class for dialogs with ok and cancel button //
22 ///////////////////////////////////////////////////////////////////////////////
25 #include "AliMonitorDialog.h"
31 ClassImp(AliMonitorDialog)
34 //_____________________________________________________________________________
35 AliMonitorDialog::AliMonitorDialog(TGFrame* main, Int_t width, Int_t height,
38 // create a dialog with an ok and a cancel button
40 fMain = new TGTransientFrame(gClient->GetRoot(), main, width, height);
42 fFrameLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,
44 fFrame = new TGHorizontalFrame(fMain, 0, 0);
45 fMain->AddFrame(fFrame, fFrameLayout);
47 fButtonFrameLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,
49 fButtonFrame = new TGHorizontalFrame(fMain, 0, 0);
50 fMain->AddFrame(fButtonFrame, fButtonFrameLayout);
52 fButtonLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,
54 fOkButton = new TGTextButton(fButtonFrame, " &Ok ", 1);
55 fButtonFrame->AddFrame(fOkButton, fButtonLayout);
56 fOkButton->Connect("Clicked()", "AliMonitorDialog", this, "DoOk()");
58 fCancelButton = new TGTextButton(fButtonFrame, " &Cancel ", 2);
59 fButtonFrame->AddFrame(fCancelButton, fButtonLayout);
60 fCancelButton->Connect("Clicked()", "AliMonitorDialog", this,
66 fMain->Connect("CloseWindow()", "AliMonitorDialog", this, "CloseWindow()");
70 gVirtualX->TranslateCoordinates(main->GetId(), gClient->GetRoot()->GetId(),
71 (main->GetWidth() - width) >> 1,
72 (main->GetHeight() - height) >> 1,
77 fMain->SetWMPosition(x, y);
78 fMain->SetWMSize(width, height);
79 fMain->SetWMSizeHints(width, height, width, height, 0, 0);
80 fMain->MapSubwindows();
85 //_____________________________________________________________________________
86 AliMonitorDialog::AliMonitorDialog(const AliMonitorDialog& dlg) :
89 AliFatal("copy constructor not implemented");
92 //_____________________________________________________________________________
93 AliMonitorDialog& AliMonitorDialog::operator = (const AliMonitorDialog&
96 AliFatal("assignment operator not implemented");
100 //_____________________________________________________________________________
101 AliMonitorDialog::~AliMonitorDialog()
106 delete fCancelButton;
107 delete fButtonLayout;
109 delete fButtonFrameLayout;
116 //_____________________________________________________________________________
117 void AliMonitorDialog::CloseWindow() const
119 // called when the window is closed
124 //_____________________________________________________________________________
125 void AliMonitorDialog::DoOk()
127 // called when the ok button is clicked
130 fMain->SendCloseMessage();
133 //_____________________________________________________________________________
134 void AliMonitorDialog::DoCancel()
136 // called when the cancel button is clicked
139 fMain->SendCloseMessage();