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"
30 ClassImp(AliMonitorDialog)
33 //_____________________________________________________________________________
34 AliMonitorDialog::AliMonitorDialog(TGFrame* main, Int_t width, Int_t height,
37 // create a dialog with an ok and a cancel button
39 fMain = new TGTransientFrame(gClient->GetRoot(), main, width, height);
41 fFrameLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,
43 fFrame = new TGHorizontalFrame(fMain, 0, 0);
44 fMain->AddFrame(fFrame, fFrameLayout);
46 fButtonFrameLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,
48 fButtonFrame = new TGHorizontalFrame(fMain, 0, 0);
49 fMain->AddFrame(fButtonFrame, fButtonFrameLayout);
51 fButtonLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,
53 fOkButton = new TGTextButton(fButtonFrame, " &Ok ", 1);
54 fButtonFrame->AddFrame(fOkButton, fButtonLayout);
55 fOkButton->Connect("Clicked()", "AliMonitorDialog", this, "DoOk()");
57 fCancelButton = new TGTextButton(fButtonFrame, " &Cancel ", 2);
58 fButtonFrame->AddFrame(fCancelButton, fButtonLayout);
59 fCancelButton->Connect("Clicked()", "AliMonitorDialog", this,
65 fMain->Connect("CloseWindow()", "AliMonitorDialog", this, "CloseWindow()");
69 gVirtualX->TranslateCoordinates(main->GetId(), gClient->GetRoot()->GetId(),
70 (main->GetWidth() - width) >> 1,
71 (main->GetHeight() - height) >> 1,
76 fMain->SetWMPosition(x, y);
77 fMain->SetWMSize(width, height);
78 fMain->SetWMSizeHints(width, height, width, height, 0, 0);
79 fMain->MapSubwindows();
84 //_____________________________________________________________________________
85 AliMonitorDialog::AliMonitorDialog(const AliMonitorDialog& dlg) :
88 Fatal("AliMonitorDialog", "copy constructor not implemented");
91 //_____________________________________________________________________________
92 AliMonitorDialog& AliMonitorDialog::operator = (const AliMonitorDialog&
95 Fatal("operator =", "assignment operator not implemented");
99 //_____________________________________________________________________________
100 AliMonitorDialog::~AliMonitorDialog()
105 delete fCancelButton;
106 delete fButtonLayout;
108 delete fButtonFrameLayout;
115 //_____________________________________________________________________________
116 void AliMonitorDialog::CloseWindow() const
118 // called when the window is closed
123 //_____________________________________________________________________________
124 void AliMonitorDialog::DoOk()
126 // called when the ok button is clicked
129 fMain->SendCloseMessage();
132 //_____________________________________________________________________________
133 void AliMonitorDialog::DoCancel()
135 // called when the cancel button is clicked
138 fMain->SendCloseMessage();