#include "TGFrame.h"
#include "TGLayout.h"
#include "TString.h"
#include "TGPicture.h"
#include "TImage.h"
#include "TGShapedFrame.h"
#include "Riostream.h"
ClassImp(TGShapedFrame)
TGShapedFrame::TGShapedFrame(const char *pname, const TGWindow *p, UInt_t w,
UInt_t h, UInt_t options) :
TGCompositeFrame(p, w, h, options), fBgnd(0), fImage(0)
{
TString picName;
if (options & kTempFrame) {
SetWindowAttributes_t attr;
attr.fMask = kWAOverrideRedirect | kWASaveUnder;
attr.fOverrideRedirect = kTRUE;
attr.fSaveUnder = kTRUE;
gVirtualX->ChangeWindowAttributes(fId, &attr);
}
if (pname)
picName = pname;
else
picName = "Default.png";
fImage = TImage::Open(picName.Data());
if (!fImage || !fImage->IsValid())
Error("TGShapedFrame::TGShapedFrame", Form("%s not found",
picName.Data()));
fBgnd = fClient->GetPicturePool()->GetPicture(picName.Data(),
fImage->GetPixmap(), fImage->GetMask());
gVirtualX->ShapeCombineMask(fId, 0, 0, fBgnd->GetMask());
SetBackgroundPixmap(fBgnd->GetPicture());
MapSubwindows();
Resize();
Resize(fBgnd->GetWidth(), fBgnd->GetHeight());
}
TGShapedFrame::~TGShapedFrame()
{
delete fImage;
fClient->FreePicture(fBgnd);
}
void TGShapedFrame::SavePrimitive(ostream &out, Option_t *option )
{
if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
out << endl << " // shaped frame" << endl;
out << " TGShapedFrame *";
out << GetName() << " = new TGShapedFrame(" << fImage->GetName()
<< "," << fParent->GetName() << "," << GetWidth() << ","
<< GetHeight();
if (fBackground == GetDefaultFrameBackground()) {
if (!GetOptions()) {
out << ");" << endl;
} else {
out << "," << GetOptionString() <<");" << endl;
}
} else {
out << "," << GetOptionString() << ",ucolor);" << endl;
}
TGLayoutManager * lm = GetLayoutManager();
if ((GetOptions() & kHorizontalFrame) &&
(lm->InheritsFrom(TGHorizontalLayout::Class()))) {
;
} else if ((GetOptions() & kVerticalFrame) &&
(lm->InheritsFrom(TGVerticalLayout::Class()))) {
;
} else {
out << " " << GetName() <<"->SetLayoutManager(";
lm->SavePrimitive(out, option);
out << ");"<< endl;
}
SavePrimitiveSubframes(out, option);
}
Last change: Wed Jun 25 08:42:41 2008
Last generated: 2008-06-25 08:42
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.