20 ClassImp(TGShapedFrame);
25 TGShapedFrame::TGShapedFrame(
const char *pname,
const TGWindow *p, UInt_t w,
26 UInt_t h, UInt_t options) :
27 TGCompositeFrame(p, w, h, options), fBgnd(0), fImage(0)
31 if (options & kTempFrame) {
32 SetWindowAttributes_t attr;
33 attr.fMask = kWAOverrideRedirect | kWASaveUnder;
34 attr.fOverrideRedirect = kTRUE;
35 attr.fSaveUnder = kTRUE;
36 gVirtualX->ChangeWindowAttributes(fId, &attr);
42 picName =
"Default.png";
43 fImage = TImage::Open(picName.Data());
44 if (!fImage || !fImage->IsValid())
45 Error(
"TGShapedFrame",
"%s not found", picName.Data());
46 fBgnd = fClient->GetPicturePool()->GetPicture(picName.Data(),
47 fImage->GetPixmap(), fImage->GetMask());
49 gVirtualX->ShapeCombineMask(fId, 0, 0, fBgnd->GetMask());
51 SetBackgroundPixmap(fBgnd->GetPicture());
55 Resize(fBgnd->GetWidth(), fBgnd->GetHeight());
61 TGShapedFrame::~TGShapedFrame()
64 fClient->FreePicture(fBgnd);
70 void TGShapedFrame::SavePrimitive(std::ostream &out, Option_t *option )
72 if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
74 out << std::endl <<
" // shaped frame" << std::endl;
75 out <<
" TGShapedFrame *";
76 out << GetName() <<
" = new TGShapedFrame(" << fImage->GetName()
77 <<
"," << fParent->GetName() <<
"," << GetWidth() <<
","
80 if (fBackground == GetDefaultFrameBackground()) {
82 out <<
");" << std::endl;
84 out <<
"," << GetOptionString() <<
");" << std::endl;
87 out <<
"," << GetOptionString() <<
",ucolor);" << std::endl;
89 if (option && strstr(option,
"keep_names"))
90 out <<
" " << GetName() <<
"->SetName(\"" << GetName() <<
"\");" << std::endl;
95 TGLayoutManager * lm = GetLayoutManager();
96 if ((GetOptions() & kHorizontalFrame) &&
97 (lm->InheritsFrom(TGHorizontalLayout::Class()))) {
99 }
else if ((GetOptions() & kVerticalFrame) &&
100 (lm->InheritsFrom(TGVerticalLayout::Class()))) {
103 out <<
" " << GetName() <<
"->SetLayoutManager(";
104 lm->SavePrimitive(out, option);
105 out <<
");"<< std::endl;
108 SavePrimitiveSubframes(out, option);