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,
39 fMain(new TGTransientFrame(gClient->GetRoot(), main, width, height)),
40 fFrameLayout(new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2, 2, 2, 2)),
41 fFrame(new TGHorizontalFrame(fMain, 0, 0)),
42 fButtonFrameLayout(new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2, 2, 2, 2)),
43 fButtonFrame(new TGHorizontalFrame(fMain, 0, 0)),
44 fButtonLayout(new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 15, 15, 2, 2)),
45 fOkButton(new TGTextButton(fButtonFrame, " &Ok ", 1)),
48 // create a dialog with an ok and a cancel button
50 fMain->AddFrame(fFrame, fFrameLayout);
52 fMain->AddFrame(fButtonFrame, fButtonFrameLayout);
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,
63 fMain->Connect("CloseWindow()", "AliMonitorDialog", this, "CloseWindow()");
67 gVirtualX->TranslateCoordinates(main->GetId(), gClient->GetRoot()->GetId(),
68 (main->GetWidth() - width) >> 1,
69 (main->GetHeight() - height) >> 1,
74 fMain->SetWMPosition(x, y);
75 fMain->SetWMSize(width, height);
76 fMain->SetWMSizeHints(width, height, width, height, 0, 0);
77 fMain->MapSubwindows();
82 //_____________________________________________________________________________
83 AliMonitorDialog::~AliMonitorDialog()
91 delete fButtonFrameLayout;
98 //_____________________________________________________________________________
99 void AliMonitorDialog::CloseWindow() const
101 // called when the window is closed
106 //_____________________________________________________________________________
107 void AliMonitorDialog::DoOk()
109 // called when the ok button is clicked
112 fMain->SendCloseMessage();
115 //_____________________________________________________________________________
116 void AliMonitorDialog::DoCancel()
118 // called when the cancel button is clicked
121 fMain->SendCloseMessage();