GButtonFrame.cxx

Go to the documentation of this file.
00001 // Author: Bertrand Bellenot   22/08/02
00002 
00003 /*************************************************************************
00004  * Copyright (C) 1995-2002, Bertrand Bellenot.                           *
00005  * All rights reserved.                                                  *
00006  *                                                                       *
00007  * For the licensing terms see the LICENSE file.                         *
00008  *************************************************************************/
00009 
00010 #include <TGButton.h>
00011 #include "GButtonFrame.h"
00012 
00013 //______________________________________________________________________________
00014 // GButtonFrame
00015 //
00016 // A GButtonFrame is a frame containing the RootShower buttons. 
00017 //______________________________________________________________________________
00018 
00019 
00020 //______________________________________________________________________________
00021 GButtonFrame::GButtonFrame(const TGWindow* p, TGWindow* buttonHandler, 
00022                            Int_t nextEventId, Int_t showTrackId, 
00023                            Int_t interruptSimId) : 
00024                            TGCompositeFrame(p, 100, 100, kVerticalFrame)
00025 {
00026    // Create GButtonFrame object, with TGWindow parent *p.
00027    //
00028    // buttonHandler = pointer to button handler TGWindow
00029    // nextEventId = id of NextEvent button
00030 
00031    // Create Layout hints
00032    fButtonLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 2, 2, 2);
00033 
00034    // Create Event Buttons
00035    fNextEventButton = new TGTextButton(this, "Start &New Event", nextEventId);
00036    fNextEventButton->Associate(buttonHandler);
00037    fNextEventButton->SetToolTipText("Start new simulation event");
00038    AddFrame(fNextEventButton, fButtonLayout);
00039    fStopSimButton = new TGTextButton(this, "&Interrupt Simulation", interruptSimId);
00040    fStopSimButton->Associate(buttonHandler);
00041    fStopSimButton->SetToolTipText("Interrupts the current simulation");
00042    AddFrame(fStopSimButton, fButtonLayout);
00043    fShowTrackButton = new TGTextButton(this, "&Show Selection", showTrackId);
00044    fShowTrackButton->Associate(buttonHandler);
00045    fShowTrackButton->SetToolTipText("Shows the selected track");
00046    AddFrame(fShowTrackButton, fButtonLayout);
00047 
00048    fNextEventButton->Resize(150,GetDefaultHeight());
00049    fStopSimButton->Resize(150,GetDefaultHeight());
00050    fShowTrackButton->Resize(150,GetDefaultHeight());
00051 
00052    SetState(kAllActive);
00053    fShowTrackButton->SetState(kButtonDisabled);
00054    fStopSimButton->SetState(kButtonDisabled);
00055 }
00056 
00057 //______________________________________________________________________________
00058 GButtonFrame::~GButtonFrame()
00059 {
00060    // Destroy GButtonFrame object. Delete all created widgets
00061 
00062    delete fNextEventButton;
00063    delete fButtonLayout;
00064 }
00065 
00066 //______________________________________________________________________________
00067 void GButtonFrame::SetState(EState state)
00068 {
00069    // Set the state of the GButtonFrame. This sets the state of
00070    // the TGButton's in this frame.
00071 
00072    switch (state) {
00073       case kAllActive:
00074          fNextEventButton->SetState(kButtonUp);
00075          fShowTrackButton->SetState(kButtonUp);
00076          fStopSimButton->SetState(kButtonDisabled);
00077          break;
00078 
00079       case kNoneActive:
00080          fNextEventButton->SetState(kButtonDisabled);
00081          fShowTrackButton->SetState(kButtonDisabled);
00082          fStopSimButton->SetState(kButtonUp);
00083          break;
00084 
00085    } // switch state 
00086    // make sure window gets updated...
00087    gClient->HandleInput();
00088 }
00089 

Generated on Tue Jul 5 15:15:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1