There is nothing impossible because you can overload TG* Classses
methods.
The following is an example how to implement the button with 2-state
(On/Off) pictures.
(for example Qt's QToolButton = http://www.troll.no/qt/qtoolbutton.html
can be displayed as one of the 6 pictures
smallOff,smallOn,smallDisabled,largeOn,largeOff,largeDisabled )
//////////////////////////////////////////////////////////////////////////////
class MyButton : public QTGPictureButton
{
protected:
const TGPicture* fOn; // picture displayed when button is On
const TGPicture* fOff // picture displayed when button is Off
Bool_t IsDown() const { return !(fOptions & kRaisedFrame); }
public:
MyButton(const TGWindow *p, Int_t id, const TGPicture *Off, const
TGPicture *On);
~MyButton();
virtual void SetState(EButtonState state);
ClassDef(MyButton,0) // 2 state picture button
};
ClassImp(MyButton)
//______________________________________________________________________________
MyButton::MyButton(const TGWindow* p, Int_t id,const TGPicture *Off,
const TGPicture *On ):
TGPictureButton(p,Off,id)
{
// ctor
fState = kButtonUp;
fPic = fOff;
// supposed fOff/fOn pictures has the same size
// comment : settings of button's sizes are different from
TGPictureButton's ( you can play with it)
fTWidth = fPic->GetWidth();
fTHeight = fPic->GetHeight();
Resize(fTWidth+1,fTHeight+1);
fClient->NeedRedraw(this);
}
//______________________________________________________________________________
MyButton::~MyButton()
{
// dtor
if(fOn) fClient->FreePicture(fOn);
if(fOff) fClient->FreePicture(fOff);
}
//______________________________________________________________________________
void MyButton::SetState(EButtonState state)
{
// we need overload only this method
TGPictureButton::SetState(state);
if(fState == kButtonDisable) return;
fPic= IsDown() ? fOn : fOff;
}
////////////////////////////////////////////////////////////////////////////////
Hope these hints could help,
with best regards . Valery