source: trunk/Mars/mbase/MProgressBar.cc@ 17337

Last change on this file since 17337 was 9195, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 2.7 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Thomas Bretz, 9/2002 <mailto:tbretz@astro-uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MProgressBar
28//
29// Simple window with progress bar. Can be used in an eventloop.
30//
31/////////////////////////////////////////////////////////////////////////////
32#include "MProgressBar.h"
33
34#include <stdlib.h> // rand (Ubuntu 8.10)
35
36#include <TSystem.h> // gSystem
37#include <TGProgressBar.h> // TGHProgressBar
38
39#include "MGList.h"
40
41ClassImp(MProgressBar);
42
43// --------------------------------------------------------------------------
44//
45// Default constructor. Opens a window with a progress bar. Get a pointer
46// to the bar by calling GetBar. This pointer can be used for the
47// eventloop.
48//
49// Be carefull: killing or closing the window while the progress meter
50// is still in use may cause segmentation faults. Please kill the window
51// always by deleting the corresponding object.
52//
53MProgressBar::MProgressBar() : TGTransientFrame(gClient->GetRoot(), gClient->GetRoot(), 1, 1)
54{
55 fList = new MGList;
56 fList->SetOwner();
57
58 //SetMWMHints(0, 0, 0);
59
60 SetWMSizeHints(150, 15, 640, 480, 10, 10); // set the smallest and biggest size of the Main frame
61 Move(rand()%100+50, rand()%100+50);
62 Resize(150, 30);
63
64 TGLayoutHints *laybar=new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 2,2,2,2);
65 fList->Add(laybar);
66
67 fBar=new TGHProgressBar(this);
68 fBar->ShowPosition();
69 AddFrame(fBar, laybar);
70 fList->Add(fBar);
71
72 Layout();
73
74 MapSubwindows();
75
76 SetWindowName("Progress");
77 SetIconName("Progress");
78
79 MapWindow();
80}
81
82// --------------------------------------------------------------------------
83//
84// Destruct the window with all its tiles. Also the Progress Bar object
85// is deleted.
86//
87MProgressBar::~MProgressBar()
88{
89 delete fList;
90}
91
Note: See TracBrowser for help on using the repository browser.