/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/EventDisplay/BesVisLib/BesVisLib-00-04-04/src/BesGPictureButton.cxx

Go to the documentation of this file.
00001 
00002 #include "BesVisLib/BesGPictureButton.h"
00003 
00004 using namespace std;
00005 
00006 #ifndef __CINT__
00007 ClassImp(BesGPictureButton)
00008 #endif
00009 
00010 //______________________________________________________________________________
00011 BesGPictureButton::BesGPictureButton(const TGWindow *p, const TGPicture *pic,
00012                                      Int_t id, GContext_t norm, UInt_t option) : TGPictureButton(p, pic, id, norm, option)
00013 {
00014     fPicHL = 0;
00015     fState = false;
00016 }
00017 
00018 //______________________________________________________________________________
00019 BesGPictureButton::BesGPictureButton(const TGWindow *p, const TGPicture *pic,
00020                                      const char *cmd, Int_t id, GContext_t norm, UInt_t option)
00021         : TGPictureButton(p, pic, cmd, id, norm, option)
00022 {
00023     fPicHL = 0;
00024     fState = false;
00025 }
00026 
00027 //______________________________________________________________________________
00028 BesGPictureButton::BesGPictureButton(const TGWindow *p, const char *pic,
00029                                      Int_t id, GContext_t norm, UInt_t option) : TGPictureButton(p, pic, id, norm, option)
00030 {
00031     fPicHL = 0;
00032     fState = false;
00033 }
00034 
00035 //______________________________________________________________________________
00036 Bool_t BesGPictureButton::HandleCrossing(Event_t *event)
00037 {
00038     // Handle mouse crossing event.
00039 
00040     static const TGPicture *picTemp;
00041     static Bool_t state; // state when entering
00042 
00043     if (fPicHL) {
00044         if (event->fType == kEnterNotify) {
00045             picTemp = fPic;
00046             state = fState;
00047             SetPicture(fPicHL);
00048         }
00049         else {
00050             if (fState == state) SetPicture(picTemp); // if state unchanged, set to pic when cursor entering
00051             else SetPicture(fPic);                   // else, set to state pic
00052         }
00053     }
00054 
00055     /*
00056      if (fTip) {
00057         if (event->fType == kEnterNotify)
00058            fTip->Reset();
00059         else
00060            fTip->Hide();
00061      }
00062 
00063      if ((fgDbw != event->fWindow) || (fgReleaseBtn == event->fWindow)) return kTRUE;
00064 
00065      if (!(event->fState & (kButton1Mask | kButton2Mask | kButton3Mask)))
00066         return kTRUE;
00067 
00068      if (fState == kButtonEngaged || fState == kButtonDisabled) return kTRUE;
00069 
00070      if (event->fType == kEnterNotify) {
00071         SetState(kButtonDown, kFALSE);
00072      } else {
00073         SetState(kButtonUp, kFALSE);
00074      }
00075 
00076     */
00077     TGButton::HandleCrossing(event);
00078     return kTRUE;
00079 }
00080 
00081 //______________________________________________________________________________
00082 void BesGPictureButton::SetPicture(const TGPicture *new_pic)
00083 {
00084     // once you SetPicture, you show set the button state
00085     TGPictureButton::SetPicture(new_pic);
00086 }

Generated on Tue Nov 29 23:12:04 2016 for BOSS_7.0.2 by  doxygen 1.4.7