00001
00002
00003
00004
00005
00006 #include "XSStepButton.h"
00007
00008
00009
00010
00011 XSStepButton::XSStepButton( const TGWindow *p, Int_t id )
00012 : TGCompositeFrame(p, 10, 10, kFixedSize)
00013 {
00014 buttonId = id;
00015 fMsgWindow = NULL;
00016
00017 lHints = new TGLayoutHints(kLHintsTop | kLHintsLeft);
00018 upButton = new TGPictureButton(this,
00019 fClient->GetPicture("arrow_up.xpm"),XSSTEPBUTTON_UP);
00020 upButton->Associate(this);
00021 downButton = new TGPictureButton(this,
00022 fClient->GetPicture("arrow_down.xpm"),XSSTEPBUTTON_DOWN);
00023 downButton->Associate(this);
00024 AddFrame(upButton, lHints);
00025 AddFrame(downButton, lHints);
00026
00027 width = upButton->GetDefaultWidth() + 2*fBorderWidth;
00028 height = 2*upButton->GetDefaultHeight() + 2*fBorderWidth;
00029
00030 MapSubwindows();
00031 Resize(GetDefaultSize());
00032 MapWindow();
00033 }
00034
00035
00036 XSStepButton::~XSStepButton( )
00037 {
00038 delete lHints;
00039 delete upButton;
00040 delete downButton;
00041 }
00042
00043
00044 Bool_t
00045 XSStepButton::ProcessMessage(Long_t msg, Long_t param1, Long_t )
00046 {
00047 switch (GET_MSG(msg)) {
00048 case kC_COMMAND:
00049 switch (GET_SUBMSG(msg)) {
00050 case kCM_BUTTON:
00051
00052 if (fMsgWindow)
00053 SendMessage(
00054 fMsgWindow,
00055 MK_MSG(kC_COMMAND,
00056 kCM_BUTTON),
00057 buttonId,
00058 param1);
00059 break;
00060 default:
00061 break;
00062 }
00063 default:
00064 break;
00065 }
00066 return kTRUE;
00067 }