52 const TGFont *TGLVEntry::fgDefaultFont = 0;
53 TGGC *TGLVEntry::fgDefaultGC = 0;
55 const TGFont *TGListView::fgDefaultFont = 0;
56 TGGC *TGListView::fgDefaultGC = 0;
60 ClassImp(TGLVContainer);
66 TGLVEntry::TGLVEntry(
const TGWindow *p,
const TGPicture *bigpic,
67 const TGPicture *smallpic, TGString *name,
68 TGString **subnames, EListViewMode viewMode,
69 UInt_t options, ULong_t back) :
70 TGFrame(p, 10, 10, options, back)
78 fCheckMark = fClient->GetPicture(
"checkmark_t.xpm");
90 fFontStruct = GetDefaultFontStruct();
91 fNormGC = GetDefaultGC()();
93 Int_t max_ascent, max_descent;
94 fTWidth = gVirtualX->TextWidth(fFontStruct,
95 fItemName ? fItemName->GetString() :
"",
96 fItemName ? fItemName->GetLength() : 0);
97 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
98 fTHeight = max_ascent + max_descent;
102 for (i = 0; fSubnames[i] != 0; ++i)
106 for (i = 0; fSubnames[i] != 0; ++i) {
107 fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
108 fSubnames[i]->GetLength());
114 fViewMode = (EListViewMode)-1;
115 SetViewMode(viewMode);
125 TGLVEntry::TGLVEntry(
const TGLVContainer *p,
const TString& name,
126 const TString& cname, TGString **subnames,
127 UInt_t options, Pixel_t back) :
128 TGFrame(p, 10, 10, options, back)
133 fBigPic = fClient->GetMimeTypeList()->GetIcon(cname, kFALSE);
134 fCheckMark = fClient->GetPicture(
"checkmark_t.xpm");
138 fBigPic = fClient->GetPicture(
"doc_s.xpm");
140 fSmallPic = fClient->GetMimeTypeList()->GetIcon(cname, kTRUE);
142 fSmallPic = fClient->GetPicture(
"doc_t.xpm");
145 fItemName =
new TGString(name);
146 fSubnames = subnames;
154 fFontStruct = GetDefaultFontStruct();
155 fNormGC = GetDefaultGC()();
157 Int_t max_ascent, max_descent;
158 fTWidth = gVirtualX->TextWidth(fFontStruct, fItemName->GetString(), fItemName->GetLength());
159 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
160 fTHeight = max_ascent + max_descent;
164 for (i = 0; fSubnames[i] != 0; ++i)
168 for (i = 0; fSubnames[i] != 0; ++i) {
169 fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
170 fSubnames[i]->GetLength());
176 fViewMode = (EListViewMode)-1;
177 SetViewMode((EListViewMode)p->GetViewMode());
183 TGLVEntry::~TGLVEntry()
185 if (fItemName)
delete fItemName;
186 if (fSelPic)
delete fSelPic;
188 for (Int_t i = 0; fSubnames[i] != 0; ++i)
delete fSubnames[i];
197 void TGLVEntry::SetSubnames(
const char* n1,
const char* n2,
const char* n3,
198 const char* n4,
const char* n5,
const char* n6,
199 const char* n7,
const char* n8,
const char* n9,
200 const char* n10,
const char* n11,
const char* n12)
203 for (Int_t i = 0; fSubnames[i] != 0; ++i)
delete fSubnames[i];
211 if (n12 && strlen(n12)) ncol=12;
212 else if (n11 && strlen(n11)) ncol=11;
213 else if (n10 && strlen(n10)) ncol=10;
214 else if (n9 && strlen(n9)) ncol=9;
215 else if (n8 && strlen(n8)) ncol=8;
216 else if (n7 && strlen(n7)) ncol=7;
217 else if (n6 && strlen(n6)) ncol=6;
218 else if (n5 && strlen(n5)) ncol=5;
219 else if (n4 && strlen(n4)) ncol=4;
220 else if (n3 && strlen(n3)) ncol=3;
221 else if (n2 && strlen(n2)) ncol=2;
222 else if (n1 && strlen(n1)) ncol=1;
226 fSubnames =
new TGString* [ncol+1];
228 if (ncol>11) fSubnames[11] =
new TGString(n12);
229 if (ncol>10) fSubnames[10] =
new TGString(n11);
230 if (ncol>9) fSubnames[9] =
new TGString(n10);
231 if (ncol>8) fSubnames[8] =
new TGString(n9);
232 if (ncol>7) fSubnames[7] =
new TGString(n8);
233 if (ncol>6) fSubnames[6] =
new TGString(n7);
234 if (ncol>5) fSubnames[5] =
new TGString(n6);
235 if (ncol>4) fSubnames[4] =
new TGString(n5);
236 if (ncol>3) fSubnames[3] =
new TGString(n4);
237 if (ncol>2) fSubnames[2] =
new TGString(n3);
238 if (ncol>1) fSubnames[1] =
new TGString(n2);
239 if (ncol>0) fSubnames[0] =
new TGString(n1);
242 fCtw =
new int[ncol];
245 for (
int i = 0; i<ncol; i++) {
246 fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
247 fSubnames[i]->GetLength());
254 void TGLVEntry::Activate(Bool_t a)
256 if (fActive == a)
return;
260 fSelPic =
new TGSelectedPicture(gClient, fCurrent);
262 if (fSelPic)
delete fSelPic;
271 void TGLVEntry::SetViewMode(EListViewMode viewMode)
273 if (viewMode != fViewMode) {
274 fViewMode = viewMode;
275 if (viewMode == kLVLargeIcons)
278 fCurrent = fSmallPic;
280 if (fSelPic)
delete fSelPic;
281 fSelPic =
new TGSelectedPicture(gClient, fCurrent);
283 gVirtualX->ClearWindow(fId);
284 Resize(GetDefaultSize());
285 fClient->NeedRedraw(
this);
292 void TGLVEntry::SetPictures(
const TGPicture *bigpic,
const TGPicture *smallpic)
294 if (!bigpic || !smallpic)
return;
296 gVirtualX->ClearWindow(fId);
299 fSmallPic = smallpic;
300 fCurrent = fViewMode == kLVLargeIcons ? fBigPic : fSmallPic;
302 if (fSelPic)
delete fSelPic;
303 fSelPic =
new TGSelectedPicture(gClient, fCurrent);
306 gVirtualX->ClearWindow(fId);
314 void TGLVEntry::DoRedraw()
324 void TGLVEntry::DrawCopy(Handle_t
id, Int_t x, Int_t y)
326 Int_t ix, iy, lx, ly;
327 Int_t max_ascent, max_descent;
329 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
330 fTWidth = gVirtualX->TextWidth(fFontStruct, fItemName->GetString(), fItemName->GetLength());
331 fTHeight = max_ascent + max_descent;
333 if (fViewMode == kLVLargeIcons) {
334 ix = (fWidth - fCurrent->GetWidth()) >> 1;
336 lx = (fWidth - fTWidth) >> 1;
337 ly = fHeight - (fTHeight + 1) - 2;
340 iy = (fHeight - fCurrent->GetHeight()) >> 1;
341 lx = fCurrent->GetWidth() + 2;
342 ly = (fHeight - (fTHeight + 1)) >> 1;
345 if ((fChecked) && (fCheckMark)) {
346 if (fViewMode == kLVLargeIcons) {
347 fCheckMark->Draw(
id, fNormGC, x + ix + 8, y + iy + 8);
348 gVirtualX->SetForeground(fNormGC, fgWhitePixel);
349 gVirtualX->FillRectangle(
id, fNormGC, x + lx, y + ly, fTWidth, fTHeight + 1);
350 gVirtualX->SetForeground(fNormGC, fgBlackPixel);
353 fCheckMark->Draw(
id, fNormGC, x + ix, y + iy);
354 gVirtualX->SetForeground(fNormGC, fgWhitePixel);
355 gVirtualX->FillRectangle(
id, fNormGC, x + lx, y, fWidth-lx, fHeight);
356 gVirtualX->SetForeground(fNormGC, fgBlackPixel);
361 if (fViewMode == kLVDetails && fSubnames && fCpos && fJmode && fCtw) {
362 TString tmpString = *fItemName;
363 Int_t ftmpWidth = gVirtualX->TextWidth(fFontStruct, tmpString,
365 if ( ftmpWidth > (fCpos[0] - lx) ) {
366 for (Int_t j = fItemName->Length() - 1 ; j > 0; j--) {
367 tmpString = (*fItemName)(0,j) +
"...";
368 ftmpWidth = gVirtualX->TextWidth(GetDefaultFontStruct(), tmpString,
370 if ( ftmpWidth <= (fCpos[0] - lx) ) {
376 if (fSelPic) fSelPic->Draw(
id, fNormGC, x + ix, y + iy);
377 gVirtualX->SetForeground(fNormGC, fgDefaultSelectedBackground);
378 gVirtualX->FillRectangle(
id, fNormGC, x + lx, y, fWidth-(lx+4), fHeight);
379 gVirtualX->SetForeground(fNormGC, fClient->GetResourcePool()->GetSelectedFgndColor());
381 fCurrent->Draw(
id, fNormGC, x + ix, y + iy);
382 gVirtualX->SetForeground(fNormGC, fgWhitePixel);
383 gVirtualX->FillRectangle(
id, fNormGC, x + lx, y, fWidth-(lx+4), fHeight);
384 gVirtualX->SetForeground(fNormGC, fgBlackPixel);
387 TGString tmpTGString(tmpString);
388 tmpTGString.Draw(
id, fNormGC, x+lx, y+ly + max_ascent);
389 }
else if (fViewMode == kLVLargeIcons) {
391 if (fSelPic) fSelPic->Draw(
id, fNormGC, x + ix, y + iy);
392 gVirtualX->SetForeground(fNormGC, fgDefaultSelectedBackground);
393 gVirtualX->FillRectangle(
id, fNormGC, x + lx, y + ly, fTWidth, fTHeight + 1);
394 gVirtualX->SetForeground(fNormGC, fClient->GetResourcePool()->GetSelectedFgndColor());
396 fCurrent->Draw(
id, fNormGC, x + ix, y + iy);
397 gVirtualX->SetForeground(fNormGC, fgWhitePixel);
398 gVirtualX->FillRectangle(
id, fNormGC, x + lx, y + ly, fTWidth, fTHeight + 1);
399 gVirtualX->SetForeground(fNormGC, fgBlackPixel);
401 fItemName->Draw(
id, fNormGC, x+lx, y+ly + max_ascent);
404 gVirtualX->SetForeground(fNormGC, fgDefaultSelectedBackground);
405 gVirtualX->FillRectangle(
id, fNormGC, x + lx, y, fWidth-lx, fHeight);
406 gVirtualX->SetForeground(fNormGC, fClient->GetResourcePool()->GetSelectedFgndColor());
407 if (fSelPic) fSelPic->Draw(
id, fNormGC, x + ix, y + iy);
409 gVirtualX->SetForeground(fNormGC, fgWhitePixel);
410 gVirtualX->FillRectangle(
id, fNormGC, x + lx, y, fWidth-lx, fHeight);
411 gVirtualX->SetForeground(fNormGC, fgBlackPixel);
412 fCurrent->Draw(
id, fNormGC, x + ix, y + iy);
414 fItemName->Draw(
id, fNormGC, x+lx, y+ly + max_ascent);
417 if (fViewMode == kLVDetails) {
418 if (fSubnames && fCpos && fJmode && fCtw) {
422 gVirtualX->SetForeground(fNormGC, fClient->GetResourcePool()->GetSelectedFgndColor());
424 gVirtualX->SetForeground(fNormGC, fgBlackPixel);
427 for (i = 0; fSubnames[i] != 0; ++i) {
428 TString tmpString = *fSubnames[i];
429 Int_t ftmpWidth = gVirtualX->TextWidth(fFontStruct, tmpString,
431 if ( ftmpWidth > (fCpos[i+1] - fCpos[i]) ) {
432 for (
int j = fSubnames[i]->Length() - 1 ; j > 0; j--) {
433 tmpString = (*fSubnames[i])(0,j) +
"...";
434 ftmpWidth = gVirtualX->TextWidth(GetDefaultFontStruct(),
437 if ( ftmpWidth <= (fCpos[i+1] - fCpos[i]) ) {
444 if (fJmode[i] == kTextRight)
445 lx = fCpos[i+1] - ftmpWidth - 2;
446 else if (fJmode[i] == kTextCenterX)
447 lx = (fCpos[i] + fCpos[i+1] - ftmpWidth) >> 1;
452 TGString tmpTGString(tmpString);
453 tmpTGString.Draw(
id, fNormGC, x + lx, y + ly + max_ascent);
457 gVirtualX->SetForeground(fNormGC, fgBlackPixel);
463 TGDimension TGLVEntry::GetDefaultSize()
const
466 TGDimension isize(fCurrent ? fCurrent->GetWidth() : 0,
467 fCurrent ? fCurrent->GetHeight() : 0);
468 TGDimension lsize(fTWidth, fTHeight+1);
473 size.fWidth = TMath::Max(isize.fWidth, lsize.fWidth);
474 size.fHeight = isize.fHeight + lsize.fHeight + 6;
480 size.fWidth = isize.fWidth + lsize.fWidth + 4;
481 size.fHeight = TMath::Max(isize.fHeight, lsize.fHeight);
490 FontStruct_t TGLVEntry::GetDefaultFontStruct()
493 fgDefaultFont = gClient->GetResourcePool()->GetIconFont();
494 return fgDefaultFont->GetFontStruct();
500 const TGGC &TGLVEntry::GetDefaultGC()
503 fgDefaultGC =
new TGGC(*gClient->GetResourcePool()->GetFrameGC());
504 fgDefaultGC->SetFont(fgDefaultFont->GetFontHandle());
515 TGLVContainer::TGLVContainer(
const TGWindow *p, UInt_t w, UInt_t h,
516 UInt_t options, ULong_t back) :
517 TGContainer(p, w, h, options, back)
522 fMultiSelect = kFALSE;
524 fViewMode = kLVLargeIcons;
525 fItemLayout =
new TGLayoutHints(kLHintsExpandY | kLHintsCenterX);
527 SetLayoutManager(
new TGTileLayout(
this, 8));
535 TGLVContainer::TGLVContainer(TGCanvas *p,UInt_t options, ULong_t back) :
536 TGContainer(p,options, back)
541 fMultiSelect = kFALSE;
543 fViewMode = kLVLargeIcons;
544 fItemLayout =
new TGLayoutHints(kLHintsExpandY | kLHintsCenterX);
546 SetLayoutManager(
new TGTileLayout(
this, 8));
548 if (p->InheritsFrom(TGListView::Class())) fListView = (TGListView*)p;
554 TGLVContainer::~TGLVContainer()
556 if (!MustCleanup()) {
565 void TGLVContainer::SetColHeaders(
const char* n1,
const char* n2,
const char* n3,
566 const char* n4,
const char* n5,
const char* n6,
567 const char* n7,
const char* n8,
const char* n9,
568 const char* n10,
const char* n11,
const char* n12)
570 if (!fListView)
return;
573 if (n12 && strlen(n12)) ncol=12;
574 else if (n11 && strlen(n11)) ncol=11;
575 else if (n10 && strlen(n10)) ncol=10;
576 else if (n9 && strlen(n9)) ncol=9;
577 else if (n8 && strlen(n8)) ncol=8;
578 else if (n7 && strlen(n7)) ncol=7;
579 else if (n6 && strlen(n6)) ncol=6;
580 else if (n5 && strlen(n5)) ncol=5;
581 else if (n4 && strlen(n4)) ncol=4;
582 else if (n3 && strlen(n3)) ncol=3;
583 else if (n2 && strlen(n2)) ncol=2;
584 else if (n1 && strlen(n1)) ncol=1;
588 fListView->SetHeaders(ncol);
589 if (ncol>0) fListView->SetHeader(n1, kTextCenterX, kTextLeft , 0);
590 if (ncol>1) fListView->SetHeader(n2, kTextCenterX, kTextLeft , 1);
591 if (ncol>2) fListView->SetHeader(n3, kTextCenterX, kTextLeft , 2);
592 if (ncol>3) fListView->SetHeader(n4, kTextCenterX, kTextLeft , 3);
593 if (ncol>4) fListView->SetHeader(n5, kTextCenterX, kTextLeft , 4);
594 if (ncol>5) fListView->SetHeader(n6, kTextCenterX, kTextLeft , 5);
595 if (ncol>6) fListView->SetHeader(n7, kTextCenterX, kTextLeft , 6);
596 if (ncol>7) fListView->SetHeader(n8, kTextCenterX, kTextLeft , 7);
597 if (ncol>8) fListView->SetHeader(n9, kTextCenterX, kTextLeft , 8);
598 if (ncol>9) fListView->SetHeader(n10, kTextCenterX, kTextLeft , 9);
599 if (ncol>10) fListView->SetHeader(n11, kTextCenterX, kTextLeft , 10);
600 if (ncol>11) fListView->SetHeader(n12, kTextCenterX, kTextLeft , 11);
608 void TGLVContainer::SetViewMode(EListViewMode viewMode)
610 if (fViewMode != viewMode) {
611 TGLayoutHints *oldLayout = fItemLayout;
613 EListViewMode old = fViewMode;
614 fViewMode = viewMode;
615 if (fListView) fListView->SetViewMode(viewMode);
617 if (viewMode == kLVLargeIcons)
618 fItemLayout =
new TGLayoutHints(kLHintsExpandY | kLHintsCenterX);
620 fItemLayout =
new TGLayoutHints(kLHintsExpandX | kLHintsCenterY);
624 while ((el = (TGFrameElement *) next())) {
625 el->fLayout = fItemLayout;
626 ((TGLVEntry *) el->fFrame)->SetViewMode(viewMode);
633 SetLayoutManager(
new TGTileLayout(
this, 8));
637 SetLayoutManager(
new TGTileLayout(
this, 2));
641 SetLayoutManager(
new TGListLayout(
this, 2));
645 SetLayoutManager(
new TGListDetailsLayout(
this, 2));
649 TGCanvas *canvas = (TGCanvas *) this->GetParent()->GetParent();
652 UInt_t height = fHeight;
653 UInt_t width = fWidth;
654 TGPosition pos = GetPagePosition();
656 pos.fX = (pos.fX*fWidth)/width;
657 pos.fY = (pos.fY*fHeight)/height;
659 if (old == kLVList) {
660 SetVsbPosition(pos.fX);
662 }
else if (fViewMode == kLVList) {
663 SetHsbPosition(pos.fY);
665 SetVsbPosition(pos.fY);
666 SetHsbPosition(pos.fX);
674 void TGLVContainer::SetColumns(Int_t *cpos, Int_t *jmode)
681 while ((el = (TGFrameElement *) next())) {
682 ((TGLVEntry *) el->fFrame)->SetColumns(fCpos, fJmode);
690 TGDimension TGLVContainer::GetMaxItemSize()
const
692 TGDimension csize, maxsize(0,0);
696 while ((el = (TGFrameElement *) next())) {
697 csize = el->fFrame->GetDefaultSize();
698 maxsize.fWidth = TMath::Max(maxsize.fWidth, csize.fWidth);
699 maxsize.fHeight = TMath::Max(maxsize.fHeight, csize.fHeight);
701 if (fViewMode == kLVLargeIcons) {
703 maxsize.fHeight += 8;
706 maxsize.fHeight += 2;
714 Int_t TGLVContainer::GetMaxSubnameWidth(Int_t idx)
const
717 return GetMaxItemSize().fWidth;
720 Int_t width, maxwidth = 0;
724 while ((el = (TGFrameElement *) next())) {
725 TGLVEntry *entry = (TGLVEntry *) el->fFrame;
726 width = entry->GetSubnameWidth(idx-1);
727 maxwidth = TMath::Max(maxwidth, width);
735 void TGLVContainer::RemoveItemWithData(
void *userData)
739 while ((el = (TGFrameElement *) next())) {
740 TGLVEntry *f = (TGLVEntry *) el->fFrame;
741 if (f->GetUserData() == userData) {
751 void TGLVContainer::ActivateItem(TGFrameElement* el)
753 TGContainer::ActivateItem(el);
754 fLastActive = (TGLVEntry*)el->fFrame;
760 void TGLVContainer::DeActivateItem(TGFrameElement* el)
762 TGContainer::DeActivateItem(el);
763 fLastActive = (TGLVEntry*)el->fFrame;
769 Bool_t TGLVContainer::HandleButton(Event_t* event)
771 if ( !fMultiSelect ) {
772 return TGContainer::HandleButton(event);
775 Int_t total = 0, selected = fSelected, page = 0;
777 TGPosition pos = GetPagePosition();
778 TGDimension dim = GetPageDimension();
780 page = dim.fHeight/4;
782 if (event->fCode == kButton4) {
784 newpos = pos.fY - page;
785 if (newpos < 0) newpos = 0;
786 fCanvas->SetVsbPosition(newpos);
789 if (event->fCode == kButton5) {
791 newpos = fCanvas->GetVsbPosition() + page;
792 fCanvas->SetVsbPosition(newpos);
796 Int_t xx = pos.fX +
event->fX;
797 Int_t yy = pos.fY +
event->fY;
799 if (event->fType == kButtonPress) {
800 gVirtualX->SetInputFocus(fId);
802 fXp = pos.fX +
event->fX;
803 fYp = pos.fY +
event->fY;
807 Bool_t select_frame = kFALSE;
809 if (event->fState & kKeyShiftMask) {
810 Bool_t inSelection = kFALSE;
811 TGLVEntry* last = fLastActive;
813 while ((el = (TGFrameElement *) next())) {
814 select_frame = kFALSE;
816 if (!fMapSubwindows) {
817 if ((Int_t(el->fFrame->GetY()) + (Int_t)el->fFrame->GetHeight() > yy ) &&
818 (Int_t(el->fFrame->GetX()) + (Int_t)el->fFrame->GetWidth() > xx ) &&
819 (Int_t(el->fFrame->GetY()) < yy) &&
820 (Int_t(el->fFrame->GetX()) < xx)) {
821 select_frame = kTRUE;
824 if (el->fFrame->GetId() == (Window_t)event->fUser[0]) {
825 select_frame = kTRUE;
829 if (select_frame || last==el->fFrame)
830 inSelection = !inSelection;
831 if (inSelection || select_frame) {
832 if ( !el->fFrame->IsActive() ) {
836 Clicked(el->fFrame, event->fCode);
837 Clicked(el->fFrame, event->fCode, event->fXRoot, event->fYRoot);
841 }
else if (event->fState & kKeyControlMask) {
845 total = selected = 0;
848 select_frame = kFALSE;
849 while ((el = (TGFrameElement *) next())) {
850 select_frame = kFALSE;
852 if (!fMapSubwindows) {
853 if ((Int_t(el->fFrame->GetY()) + (Int_t)el->fFrame->GetHeight() > yy ) &&
854 (Int_t(el->fFrame->GetX()) + (Int_t)el->fFrame->GetWidth() > xx ) &&
855 (Int_t(el->fFrame->GetY()) < yy) &&
856 (Int_t(el->fFrame->GetX()) < xx)) {
857 select_frame = kTRUE;
860 if (el->fFrame->GetId() == (Window_t)event->fUser[0]) {
861 select_frame = kTRUE;
866 if ( el->fFrame->IsActive() ) {
873 Clicked(el->fFrame, event->fCode);
874 Clicked(el->fFrame, event->fCode, event->fXRoot, event->fYRoot);
879 if (fTotal != total || fSelected != selected) {
881 fSelected = selected;
882 SendMessage(fMsgWindow, MK_MSG(kC_CONTAINER, kCT_SELCHANGED),
886 if ( selected == 0 ) {
891 gVirtualX->DrawRectangle(fId, GetLineGC()(), fX0, fY0, fXf-fX0,
896 if (event->fType == kButtonRelease) {
897 gVirtualX->SetInputFocus(fId);
903 if (gSystem) gSystem->RemoveTimer(fScrollTimer);
905 gVirtualX->DrawRectangle(fId, GetLineGC()(), fX0, fY0, fXf-fX0,
908 SendMessage(fMsgWindow, MK_MSG(kC_CONTAINER, kCT_ITEMCLICK),
909 event->fCode, (event->fYRoot << 16) | event->fXRoot);
912 fClient->NeedRedraw(
this);
919 TList *TGLVContainer::GetSelectedEntries()
923 TList *ret =
new TList();
925 while ((el = (TGFrameElement *) next())) {
926 if (el->fFrame->IsActive()) {
927 ret->Add((TGLVEntry *)el->fFrame);
936 TList *TGLVContainer::GetSelectedItems()
940 TList *ret =
new TList();
942 while ((el = (TGFrameElement *) next())) {
943 if (el->fFrame->IsActive()) {
944 ret->Add(
new TObjString(((TGLVEntry*)el->fFrame)->GetItemName()->GetString()));
953 void TGLVContainer::LineLeft(Bool_t select)
956 if (fViewMode == kLVDetails)
return LineUp(select);
958 TGPosition pos = GetPagePosition();
959 TGDimension dim = GetPageDimension();
961 TGFrameElement *fe = (TGFrameElement*)fList->First();
964 TGFrameElement *old = fLastActiveEl;
966 if (fViewMode == kLVSmallIcons && fe == old)
return;
968 if (old) DeActivateItem(old);
969 else fLastActiveEl = fe;
971 TGDimension ms = fListView->GetMaxItemSize();
972 Int_t dx = ms.fWidth;
973 Int_t dy = ms.fHeight;
975 Int_t y = fLastActiveEl->fFrame->GetY();
976 Int_t x = fLastActiveEl->fFrame->GetX() - dx + 2;
978 Int_t hw = pos.fX + dim.fWidth;
980 TGHScrollBar *hb = GetHScrollbar();
981 if (hb && hb->IsMapped()) {
982 Int_t pg = (hb->GetPageSize()*GetWidth())/fViewPort->GetWidth();
990 fe = FindFrame(x, y);
991 if (fe && fe->fFrame->GetY() > fLastActiveEl->fFrame->GetY()) {
995 fe = FindFrame(x, y);
997 if (fViewMode == kLVList) {
998 if (fe && fe->fFrame->GetY() <= fLastActiveEl->fFrame->GetY() - (2 * dy)) {
1000 x = fe->fFrame->GetX() - dx;
1001 fe = FindFrame(x, y);
1004 if (fe && fe->fFrame->GetY() >= fLastActiveEl->fFrame->GetY() &&
1005 fe->fFrame->GetX() >= fLastActiveEl->fFrame->GetX())
1008 if (!fe || fe->fFrame->GetY() > fLastActiveEl->fFrame->GetY())
1009 fe = (TGFrameElement*)fList->First();
1010 if (!select) fSelected=1;
1019 void TGLVContainer::LineRight(Bool_t select)
1022 if (fViewMode == kLVDetails)
return LineDown(select);
1024 TGPosition pos = GetPagePosition();
1025 TGDimension dim = GetPageDimension();
1027 TGFrameElement *fe = (TGFrameElement*)fList->Last();
1030 TGFrameElement *old = fLastActiveEl;
1032 if (fViewMode == kLVSmallIcons && fe == old)
return;
1034 if (old) DeActivateItem(old);
1035 else fLastActiveEl = (TGFrameElement*)fList->First();
1037 TGDimension ms = fListView->GetMaxItemSize();
1038 Int_t dx = ms.fWidth;
1039 Int_t dy = ms.fHeight;
1041 Int_t y = fLastActiveEl->fFrame->GetY();
1042 Int_t x = fLastActiveEl->fFrame->GetX() + dx - 2;
1044 Int_t hw = pos.fX + dim.fWidth - dx;
1046 TGHScrollBar *hb = GetHScrollbar();
1047 if (x > hw && (hb && !hb->IsMapped())) {
1052 fe = FindFrame(x, y);
1053 if (fe && fe->fFrame->GetY() < fLastActiveEl->fFrame->GetY()) {
1057 fe = FindFrame(x, y);
1059 if (fViewMode == kLVList) {
1061 if (fe && fe->fFrame->GetY() <= fLastActiveEl->fFrame->GetY() &&
1062 fe->fFrame->GetX() <= fLastActiveEl->fFrame->GetX())
1065 if (!fe || fe->fFrame->GetY() < fLastActiveEl->fFrame->GetY())
1066 fe = (TGFrameElement*)fList->Last();
1067 if (!select) fSelected = 1;
1076 void TGLVContainer::LineUp(Bool_t select)
1078 TGFrameElement *fe = (TGFrameElement*)fList->First();
1081 TGFrameElement *old = fLastActiveEl;
1084 DeActivateItem(old);
1086 fLastActiveEl = (TGFrameElement*)fList->First();
1089 TGDimension ms = fListView->GetMaxItemSize();
1090 Int_t dy = ms.fHeight;
1092 Int_t y = fLastActiveEl->fFrame->GetY() - dy;
1093 Int_t x = fLastActiveEl->fFrame->GetX();
1095 fe = FindFrame(x, y);
1096 if (!fe) fe = (TGFrameElement*)fList->First();
1097 if (fe->fFrame->GetY() > fLastActiveEl->fFrame->GetY()) fe = fLastActiveEl;
1098 if (!select) fSelected = 1;
1107 void TGLVContainer::LineDown(Bool_t select)
1109 TGFrameElement *fe = (TGFrameElement*)fList->Last();
1112 TGFrameElement *old = fLastActiveEl;
1114 if (old) DeActivateItem(old);
1115 else fLastActiveEl = (TGFrameElement*)fList->First();
1117 TGDimension ms = fListView->GetMaxItemSize();
1118 Int_t dy = ms.fHeight;
1120 Int_t y = fLastActiveEl->fFrame->GetY() + dy;
1121 Int_t x = fLastActiveEl->fFrame->GetX();
1123 fe = FindFrame(x, y);
1124 if (!fe) fe = (TGFrameElement*)fList->Last();
1125 if (fe->fFrame->GetY() < fLastActiveEl->fFrame->GetY()) fe = fLastActiveEl;
1126 if (!select) fSelected = 1;
1136 TGDimension TGLVContainer::GetPageDimension()
const
1139 if (!fViewPort)
return ret;
1141 ret.fWidth = fViewPort->GetWidth();
1142 ret.fHeight = fViewPort->GetHeight();
1149 TGListView::TGListView(
const TGWindow *p, UInt_t w, UInt_t h,
1150 UInt_t options, ULong_t back) :
1151 TGCanvas(p, w, h, options, back)
1153 fViewMode = kLVLargeIcons;
1160 fJustChanged = kFALSE;
1161 fMinColumnSize = 25;
1162 fFontStruct = GetDefaultFontStruct();
1163 fNormGC = GetDefaultGC()();
1165 fHScrollbar->Connect(
"PositionChanged(Int_t)",
"TGListView",
1166 this,
"ScrollHeader(Int_t)");
1167 fHeader =
new TGHeaderFrame(fVport, 20, 20, kChildFrame | kFixedWidth);
1169 SetDefaultHeaders();
1175 TGListView::~TGListView()
1180 for (
int i = 0; i < fNColumns; i++) {
1181 delete fColHeader[i];
1182 delete fSplitHeader[i];
1184 delete [] fColHeader;
1185 delete [] fColNames;
1186 delete [] fSplitHeader;
1194 void TGListView::ScrollHeader(Int_t pos)
1196 Int_t i, xl = - pos;
1197 if (fViewMode == kLVDetails) {
1198 for (i = 0; i < fNColumns-1; ++i) {
1199 fColHeader[i]->Move(xl, 0);
1200 xl += fColHeader[i]->GetWidth();
1201 fSplitHeader[i]->Move(xl,fSplitHeader[i]->GetHeight());
1203 fColHeader[i]->Move(xl, 0);
1204 xl += fColHeader[i]->GetWidth();
1205 fSplitHeader[i]->Move(xl,fSplitHeader[i]->GetHeight());
1215 void TGListView::SetHeaders(Int_t ncolumns)
1217 if (ncolumns <= 0) {
1218 Error(
"SetHeaders",
"number of columns must be > 0");
1225 for (
int i = 0; i < fNColumns; i++) {
1226 if (fColHeader[i]) fColHeader[i]->DestroyWindow();
1227 delete fColHeader[i];
1228 delete fSplitHeader[i];
1230 delete [] fColHeader;
1231 delete [] fSplitHeader;
1232 delete [] fColNames;
1235 fNColumns = ncolumns+1;
1236 fColumns =
new int[fNColumns];
1237 fJmode =
new int[fNColumns];
1238 fColHeader =
new TGTextButton* [fNColumns];
1239 fColNames =
new TString [fNColumns];
1240 fSplitHeader =
new TGVFileSplitter* [fNColumns];
1242 for (
int i = 0; i < fNColumns; i++) {
1244 fJmode[i] = kTextLeft;
1245 fSplitHeader[i] =
new TGVFileSplitter(fHeader, 10);
1246 fSplitHeader[i]->Connect(
"LayoutListView()",
"TGListView",
1248 fSplitHeader[i]->Connect(
"LayoutHeader(TGFrame *)",
"TGListView",
1249 this,
"LayoutHeader(TGFrame *)");
1250 fSplitHeader[i]->Connect(
"DoubleClicked(TGVFileSplitter*)",
"TGListView",
1251 this,
"SetDefaultColumnWidth(TGVFileSplitter*)");
1255 fColNames[fNColumns-1] =
"";
1256 fColHeader[fNColumns-1] =
new TGTextButton(fHeader,
new TGHotString(
""), -1,
1257 fNormGC, fFontStruct, kRaisedFrame |
1258 kDoubleBorder | kFixedWidth);
1259 fColHeader[fNColumns-1]->Associate(
this);
1260 fColHeader[fNColumns-1]->SetTextJustify(kTextCenterX | kTextCenterY);
1261 fColHeader[fNColumns-1]->SetState(kButtonDisabled);
1262 fColHeader[fNColumns-1]->SetStyle(gClient->GetStyle());
1263 fJmode[fNColumns-1] = kTextCenterX;
1264 fColumns[fNColumns-1] = 0;
1265 fSplitHeader[fNColumns-1]->SetFrame(fColHeader[fNColumns-1], kTRUE);
1266 fHeader->SetColumnsInfo(fNColumns, fColHeader, fSplitHeader);
1267 fJustChanged = kTRUE;
1275 void TGListView::SetHeader(
const char *s, Int_t hmode, Int_t cmode, Int_t idx)
1277 if (idx < 0 || idx >= fNColumns-1) {
1278 Error(
"SetHeader",
"header index must be [0 - %d>", fNColumns-1);
1281 delete fColHeader[idx];
1284 fColHeader[idx] =
new TGTextButton(fHeader,
new TGHotString(s), idx,
1285 fNormGC, fFontStruct, kRaisedFrame |
1286 kDoubleBorder | kFixedWidth);
1289 if (txt.Contains(
"modified")) txt +=
" date";
1290 if (txt.Contains(
"attributes")) txt =
"type";
1291 fColHeader[idx]->SetToolTipText(Form(
"Click to sort by %s", txt.Data()));
1292 fColHeader[idx]->Associate(
this);
1293 fColHeader[idx]->SetTextJustify(hmode | kTextCenterY);
1294 fSplitHeader[idx]->SetFrame(fColHeader[idx], kTRUE);
1296 fColHeader[idx]->SetStyle(gClient->GetStyle());
1301 fJmode[idx-1] = cmode;
1303 if (!fColHeader[0])
return;
1304 int xl = fColHeader[0]->GetDefaultWidth() + 10 + fSplitHeader[0]->GetDefaultWidth();
1305 for (
int i = 1; i < fNColumns; i++) {
1307 if (!fColHeader[i])
break;
1308 xl += fColHeader[i]->GetDefaultWidth() + fSplitHeader[i]->GetDefaultWidth();
1316 const char *TGListView::GetHeader(Int_t idx)
const
1318 if (idx >= 0 && idx < fNColumns-1 && fColHeader[idx])
1319 return (
const char*) fColNames[idx];
1327 void TGListView::SetDefaultHeaders()
1330 SetHeader(
"Name", kTextLeft, kTextLeft, 0);
1331 SetHeader(
"Attributes", kTextCenterX, kTextCenterX, 1);
1332 SetHeader(
"Size", kTextRight, kTextRight, 2);
1333 SetHeader(
"Owner", kTextCenterX, kTextCenterX, 3);
1334 SetHeader(
"Group", kTextCenterX, kTextCenterX, 4);
1335 SetHeader(
"Modified", kTextCenterX, kTextCenterX, 5);
1341 void TGListView::SetViewMode(EListViewMode viewMode)
1343 TGLVContainer *container;
1345 if (fViewMode != viewMode) {
1346 fJustChanged = kTRUE;
1347 fViewMode = viewMode;
1348 container = (TGLVContainer *) fVport->GetContainer();
1349 if (container) container->SetViewMode(viewMode);
1358 void TGListView::SetContainer(TGFrame *f)
1360 if (f->InheritsFrom(TGLVContainer::Class())) {
1361 TGCanvas::SetContainer(f);
1362 ((TGLVContainer *) f)->SetColumns(fColumns, fJmode);
1363 ((TGLVContainer *) f)->SetListView(
this);
1365 Error(
"SetContainer",
"frame must inherit from TGLVContainer");
1371 void TGListView::SetIncrements(Int_t hInc, Int_t vInc)
1373 fHScrollbar->SetSmallIncrement(hInc);
1374 fVScrollbar->SetSmallIncrement(vInc);
1380 void TGListView::SetDefaultColumnWidth(TGVFileSplitter* splitter)
1382 TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1385 Error(
"SetDefaultColumnWidth",
"no listview container set yet");
1388 container->ClearViewPort();
1390 for (
int i = 0; i < fNColumns; ++i) {
1391 if ( fSplitHeader[i] == splitter ) {
1392 TString dt = fColHeader[i]->GetString();
1393 UInt_t bsize = gVirtualX->TextWidth(fColHeader[i]->GetFontStruct(),
1394 dt.Data(), dt.Length());
1395 UInt_t w = TMath::Max(fColHeader[i]->GetDefaultWidth(), bsize + 20);
1396 if (i == 0) w = TMath::Max(fMaxSize.fWidth + 10, w);
1397 if (i > 0) w = TMath::Max(container->GetMaxSubnameWidth(i) + 40, (Int_t)w);
1398 fColHeader[i]->Resize(w, fColHeader[i]->GetHeight());
1407 void TGListView::ResizeColumns()
1409 for (
int i = 0; i < fNColumns; ++i) {
1410 TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1412 Error(
"ResizeColumns",
"no listview container set yet");
1415 fMaxSize = container->GetMaxItemSize();
1416 SetDefaultColumnWidth(fSplitHeader[i]);
1423 void TGListView::Layout()
1428 TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1431 Error(
"Layout",
"no listview container set yet");
1435 fMaxSize = container->GetMaxItemSize();
1437 if (fViewMode == kLVDetails) {
1438 h = fColHeader[0]->GetDefaultHeight()-4;
1439 fHeader->MoveResize(0, 0, fWidth, h);
1440 fHeader->MapWindow();
1441 for (i = 0; i < fNColumns-1; ++i) {
1442 fColHeader[i]->SetText(fColNames[i]);
1444 if ( fJustChanged ) {
1445 w = TMath::Min(fMaxSize.fWidth + 10, fColHeader[i]->GetDefaultWidth());
1446 if (w < fMinColumnSize) w = fColHeader[i]->GetDefaultWidth();
1447 if (i == 0) w = TMath::Max(fMaxSize.fWidth + 10, w);
1448 if (i > 0) w = TMath::Max(container->GetMaxSubnameWidth(i) + 40, (Int_t)w);
1450 w = fColHeader[i]->GetWidth();
1452 w = TMath::Max(fMinColumnSize, w);
1453 if ( fColHeader[i]->GetDefaultWidth() > w ) {
1454 for (
int j = fColNames[i].Length() - 1 ; j > 0; j--) {
1455 fColHeader[i]->SetText( fColNames[i](0,j) +
"..." );
1456 if ( fColHeader[i]->GetDefaultWidth() < w )
1461 fColHeader[i]->MoveResize(xl, 0, w, h);
1462 fColHeader[i]->MapWindow();
1464 fSplitHeader[i]->Move(xl, 0);
1465 fSplitHeader[i]->MapWindow();
1468 fColHeader[i]->MoveResize(xl, 0, fVport->GetWidth()-xl, h);
1469 fColHeader[i]->MapWindow();
1470 fSplitHeader[i]->Move(fVport->GetWidth(), fSplitHeader[i]->GetHeight());
1471 fSplitHeader[i]->MapWindow();
1472 fVScrollbar->RaiseWindow();
1474 container->SetColumns(fColumns, fJmode);
1477 for (i = 0; i < fNColumns; ++i) {
1478 fColHeader[i]->UnmapWindow();
1479 fSplitHeader[i]->UnmapWindow();
1481 fHeader->UnmapWindow();
1485 TGLayoutManager *lm = container->GetLayoutManager();
1486 lm->SetDefaultWidth(xl);
1489 if (fViewMode == kLVDetails) {
1490 container->Resize(container->GetWidth(), container->GetHeight()+h);
1491 fVScrollbar->SetRange((Int_t)container->GetHeight(),
1492 (Int_t)fVport->GetHeight());
1494 fVport->MoveResize(fBorderWidth, fBorderWidth, fVport->GetWidth(),
1495 fVport->GetHeight());
1496 container->Move(0, h);
1498 container->DrawRegion(0, 0, fVport->GetWidth(), fVport->GetHeight());
1500 fColHeader[i]->MoveResize(xl, 0, fVport->GetWidth()-xl, h);
1501 fColHeader[i]->MapWindow();
1503 fVport->MoveResize(fBorderWidth, fBorderWidth, fVport->GetWidth(),
1504 fVport->GetHeight());
1505 container->Move(0, 0);
1508 fJustChanged = kFALSE;
1514 void TGListView::LayoutHeader(TGFrame *head)
1518 static Int_t oldPos = 0;
1519 if (head == 0) oldPos = 0;
1521 TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1524 Error(
"Layout",
"no listview container set yet");
1527 fMaxSize = container->GetMaxItemSize();
1528 Int_t posx = container->GetPagePosition().fX;
1530 if (fViewMode == kLVDetails) {
1531 h = fColHeader[0]->GetDefaultHeight()-4;
1532 fHeader->MoveResize(0, 0, fWidth, h);
1533 fHeader->MapWindow();
1534 for (i = 0; i < fNColumns-1; ++i) {
1535 fColHeader[i]->SetText(fColNames[i]);
1537 if ( fJustChanged ) {
1538 w = TMath::Min(fMaxSize.fWidth + 10, fColHeader[i]->GetDefaultWidth());
1539 if (w < fMinColumnSize) w = fColHeader[i]->GetDefaultWidth();
1540 if (i == 0) w = TMath::Max(fMaxSize.fWidth + 10, w);
1541 if (i > 0) w = TMath::Max(container->GetMaxSubnameWidth(i) + 40, (Int_t)w);
1543 w = fColHeader[i]->GetWidth();
1545 w = TMath::Max(fMinColumnSize, w);
1546 if ( fColHeader[i]->GetDefaultWidth() > w ) {
1547 for (
int j = fColNames[i].Length() - 1 ; j > 0; j--) {
1548 fColHeader[i]->SetText( fColNames[i](0,j) +
"..." );
1549 if ( fColHeader[i]->GetDefaultWidth() < w )
1554 if ((TGFrame *)fColHeader[i] == head) {
1556 gVirtualX->DrawLine(container->GetId(), container->GetLineGC()(),
1557 oldPos - posx, 0, oldPos - posx, fVport->GetHeight());
1559 gVirtualX->DrawLine(container->GetId(), container->GetLineGC()(),
1560 xl + w - posx, 0, xl + w - posx, fVport->GetHeight());
1564 fColHeader[i]->MoveResize(xl - posx, 0, w, h);
1565 fColHeader[i]->MapWindow();
1567 fSplitHeader[i]->Move(xl, 0);
1568 fSplitHeader[i]->MapWindow();
1571 fColHeader[i]->MoveResize(xl - posx, 0, fVport->GetWidth()-xl, h);
1572 fColHeader[i]->MapWindow();
1573 fSplitHeader[i]->Move(fVport->GetWidth(), fSplitHeader[i]->GetHeight());
1574 fSplitHeader[i]->MapWindow();
1575 fVScrollbar->RaiseWindow();
1577 fJustChanged = kFALSE;
1583 Bool_t TGListView::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1585 TGLVContainer *cnt = (TGLVContainer*)GetContainer();
1587 const TGLVEntry *entry;
1590 entry = (TGLVEntry *) cnt->GetNextSelected(&p);
1592 switch (GET_SUBMSG(msg)) {
1594 if ((cnt->NumSelected() == 1) && (entry != 0)) {
1595 Int_t x = (Int_t)(parm2 & 0xffff);
1596 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
1597 Clicked((TGLVEntry*)entry, (Int_t)parm1);
1598 Clicked((TGLVEntry*)entry, (Int_t)parm1, x, y);
1601 case kCT_ITEMDBLCLICK:
1602 if ((cnt->NumSelected() == 1) && (entry!=0)) {
1603 Int_t x = (Int_t)(parm2 & 0xffff);
1604 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
1605 DoubleClicked((TGLVEntry*)entry, (Int_t)parm1);
1606 DoubleClicked((TGLVEntry*)entry, (Int_t)parm1, x, y);
1609 case kCT_SELCHANGED:
1615 return TGCanvas::ProcessMessage(msg, parm1, parm2);
1621 void TGListView::Clicked(TGLVEntry *entry, Int_t btn)
1625 args[0] = (Long_t)entry;
1628 Emit(
"Clicked(TGLVEntry*,Int_t)", args);
1634 void TGListView::Clicked(TGLVEntry *entry, Int_t btn, Int_t x, Int_t y)
1638 args[0] = (Long_t)entry;
1643 Emit(
"Clicked(TGLVEntry*,Int_t,Int_t,Int_t)", args);
1649 void TGListView::DoubleClicked(TGLVEntry *entry, Int_t btn)
1653 args[0] = (Long_t)entry;
1656 Emit(
"DoubleClicked(TGLVEntry*,Int_t)", args);
1662 void TGListView::DoubleClicked(TGLVEntry *entry, Int_t btn, Int_t x, Int_t y)
1666 args[0] = (Long_t)entry;
1671 Emit(
"DoubleClicked(TGLVEntry*,Int_t,Int_t,Int_t)", args);
1677 FontStruct_t TGListView::GetDefaultFontStruct()
1680 fgDefaultFont = gClient->GetResourcePool()->GetIconFont();
1681 return fgDefaultFont->GetFontStruct();
1687 const TGGC &TGListView::GetDefaultGC()
1690 fgDefaultGC =
new TGGC(*gClient->GetResourcePool()->GetFrameGC());
1691 fgDefaultGC->SetFont(fgDefaultFont->GetFontHandle());
1693 return *fgDefaultGC;
1699 void TGListView::SavePrimitive(std::ostream &out, Option_t *option )
1701 if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
1703 out << std::endl <<
" // list view" << std::endl;
1704 out <<
" TGListView *";
1705 out << GetName() <<
" = new TGListView(" << fParent->GetName()
1706 <<
"," << GetWidth() <<
"," << GetHeight();
1708 if (fBackground == GetDefaultFrameBackground()) {
1709 if (GetOptions() == (kSunkenFrame | kDoubleBorder)) {
1710 out <<
");" << std::endl;
1712 out <<
"," << GetOptionString() <<
");" << std::endl;
1715 out <<
"," << GetOptionString() <<
",ucolor);" << std::endl;
1717 if (option && strstr(option,
"keep_names"))
1718 out <<
" " << GetName() <<
"->SetName(\"" << GetName() <<
"\");" << std::endl;
1720 GetContainer()->SavePrimitive(out, option);
1723 out <<
" " << GetName() <<
"->SetContainer(" << GetContainer()->GetName()
1724 <<
");" << std::endl;
1725 out <<
" " << GetName() <<
"->SetViewMode(";
1726 switch (fViewMode) {
1728 out <<
"kLVLargeIcons";
1731 out <<
"kLVSmallIcons";
1737 out <<
"kLVDetails";
1740 out <<
");" << std::endl;
1742 out <<
" " << GetContainer()->GetName() <<
"->Resize();" << std::endl;
1744 if (fHScrollbar && fHScrollbar->IsMapped()) {
1745 out <<
" " << GetName() <<
"->SetHsbPosition(" << GetHsbPosition()
1746 <<
");" << std::endl;
1749 if (fVScrollbar && fVScrollbar->IsMapped()) {
1750 out <<
" " << GetName() <<
"->SetVsbPosition(" << GetVsbPosition()
1751 <<
");" << std::endl;
1758 void TGLVContainer::SavePrimitive(std::ostream &out, Option_t *option )
1760 if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
1762 out << std::endl <<
" // list view container" << std::endl;
1763 out <<
" TGLVContainer *";
1765 if ((fParent->GetParent())->InheritsFrom(TGCanvas::Class())) {
1766 out << GetName() <<
" = new TGLVContainer(" << GetCanvas()->GetName();
1768 out << GetName() <<
" = new TGLVContainer(" << fParent->GetName();
1769 out <<
"," << GetWidth() <<
"," << GetHeight();
1771 if (fBackground == GetDefaultFrameBackground()) {
1772 if (GetOptions() == (kSunkenFrame | kDoubleBorder)) {
1773 out <<
");" << std::endl;
1775 out <<
"," << GetOptionString() <<
");" << std::endl;
1778 out <<
"," << GetOptionString() <<
",ucolor);" << std::endl;
1780 if (option && strstr(option,
"keep_names"))
1781 out <<
" " << GetName() <<
"->SetName(\"" << GetName() <<
"\");" << std::endl;