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
00039
00040 static const TGPicture *picTemp;
00041 static Bool_t state;
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);
00051 else SetPicture(fPic);
00052 }
00053 }
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 TGButton::HandleCrossing(event);
00078 return kTRUE;
00079 }
00080
00081
00082 void BesGPictureButton::SetPicture(const TGPicture *new_pic)
00083 {
00084
00085 TGPictureButton::SetPicture(new_pic);
00086 }