]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MONITOR/AliMonitorDialog.cxx
Classes for reading raw data moved to the RAW module. New on-line MONITORING module...
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorDialog.cxx
CommitLineData
04fa961a 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// This is a base class for dialogs with ok and cancel button //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24
25#include "AliMonitorDialog.h"
26
27
28ClassImp(AliMonitorDialog)
29
30
31//_____________________________________________________________________________
32AliMonitorDialog::AliMonitorDialog(TGFrame* main, Int_t width, Int_t height,
33 Bool_t cancelBtn)
34{
35// create a dialog with an ok and a cancel button
36
37 fMain = new TGTransientFrame(gClient->GetRoot(), main, width, height);
38
39 fFrameLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,
40 2, 2, 2, 2);
41 fFrame = new TGHorizontalFrame(fMain, 0, 0);
42 fMain->AddFrame(fFrame, fFrameLayout);
43
44 fButtonFrameLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,
45 2, 2, 2, 2);
46 fButtonFrame = new TGHorizontalFrame(fMain, 0, 0);
47 fMain->AddFrame(fButtonFrame, fButtonFrameLayout);
48
49 fButtonLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,
50 15, 15, 2, 2);
51 fOkButton = new TGTextButton(fButtonFrame, " &Ok ", 1);
52 fButtonFrame->AddFrame(fOkButton, fButtonLayout);
53 fOkButton->Connect("Clicked()", "AliMonitorDialog", this, "DoOk()");
54 if (cancelBtn) {
55 fCancelButton = new TGTextButton(fButtonFrame, " &Cancel ", 2);
56 fButtonFrame->AddFrame(fCancelButton, fButtonLayout);
57 fCancelButton->Connect("Clicked()", "AliMonitorDialog", this,
58 "DoCancel()");
59 } else {
60 fCancelButton = NULL;
61 }
62
63 fMain->Connect("CloseWindow()", "AliMonitorDialog", this, "CloseWindow()");
64 Int_t x;
65 Int_t y;
66 Window_t child;
67 gVirtualX->TranslateCoordinates(main->GetId(), gClient->GetRoot()->GetId(),
68 (main->GetWidth() - width) >> 1,
69 (main->GetHeight() - height) >> 1,
70 x, y, child);
71 if (x < 0) x = 0;
72 if (y < 0) y = 0;
73 fMain->Move(x, y);
74 fMain->SetWMPosition(x, y);
75 fMain->SetWMSize(width, height);
76 fMain->SetWMSizeHints(width, height, width, height, 0, 0);
77 fMain->MapSubwindows();
78 fMain->Layout();
79 fMain->MapWindow();
80}
81
82//_____________________________________________________________________________
83AliMonitorDialog::~AliMonitorDialog()
84{
85// clean up
86
87 delete fOkButton;
88 delete fCancelButton;
89 delete fButtonLayout;
90 delete fButtonFrame;
91 delete fButtonFrameLayout;
92 delete fFrame;
93 delete fFrameLayout;
94
95 delete fMain;
96}
97
98//_____________________________________________________________________________
99void AliMonitorDialog::CloseWindow()
100{
101// called when the window is closed
102
103 delete this;
104}
105
106//_____________________________________________________________________________
107void AliMonitorDialog::DoOk()
108{
109// called when the ok button is clicked
110
111 OnOkClicked();
112 fMain->SendCloseMessage();
113}
114
115//_____________________________________________________________________________
116void AliMonitorDialog::DoCancel()
117{
118// called when the cancel button is clicked
119
120 OnCancelClicked();
121 fMain->SendCloseMessage();
122}