116 const char *filetypes[] = {
"All files",
"*",
117 "ROOT files",
"*.root",
118 "ROOT macros",
"*.C",
119 "Text files",
"*.[tT][xX][tT]",
130 {
"h1_s.xpm",
"TH1", 1001, 0 },
131 {
"h2_s.xpm",
"TH2", 1002, 0 },
132 {
"h3_s.xpm",
"TH3", 1003, 0 },
133 {
"profile_s.xpm",
"TProfile", 1004, 0 },
138 {
"f1_s.xpm",
"TF1", 2001, 0 },
139 {
"f2_s.xpm",
"TF2", 2002, 0 },
144 {
"ntuple_s.xpm",
"TNtuple", 3001, 0 },
145 {
"tree_s.xpm",
"TTree", 3002, 0 },
146 {
"chain_s.xpm",
"TChain", 3003, 0 },
152 "This is the ROOT text edit widget TGTextEdit. It is not intended as\n" 153 "a full developers editor, but it is relatively complete and can ideally\n" 154 "be used to edit scripts or to present users editable config files, etc.\n\n" 155 "The text edit widget supports standard emacs style ctrl-key navigation\n" 156 "in addition to the arrow keys. By default the widget has under the right\n" 157 "mouse button a popup menu giving access to several built-in functions.\n\n" 158 "Cut, copy and paste between different editor windows and any other\n" 159 "standard text handling application is supported.\n\n" 160 "Text can be selected with the mouse while holding the left button\n" 161 "or with the arrow keys while holding the shift key pressed. Use the\n" 162 "middle mouse button to paste text at the current mouse location." 164 const char *editortxt2 =
165 "Mice with scroll-ball are properly supported.\n\n" 166 "This are the currently defined key bindings:\n" 168 " Move the cursor one character leftwards.\n" 169 " Scroll when cursor is out of frame.\n" 171 " Move the cursor one character rightwards.\n" 172 " Scroll when cursor is out of frame.\n" 174 " Deletes the character on the left side of the text cursor and moves the\n" 175 " cursor one position to the left. If a text has been marked by the user" 177 const char *editortxt3 =
178 " (e.g. by clicking and dragging) the cursor will be put at the beginning\n" 179 " of the marked text and the marked text will be removed.\n" 181 " Moves the text cursor to the left end of the line. If mark is TRUE text\n" 182 " will be marked towards the first position, if not any marked text will\n" 183 " be unmarked if the cursor is moved.\n" 185 " Moves the text cursor to the right end of the line. If mark is TRUE text\n" 186 " will be marked towards the last position, if not any marked text will\n" 187 " be unmarked if the cursor is moved.\n" 190 const char *editortxt4 =
191 " Deletes the character on the right side of the text cursor. If a text\n" 192 " has been marked by the user (e.g. by clicking and dragging) the cursor\n" 193 " will be put at the beginning of the marked text and the marked text will\n" 195 "Shift - Left Arrow\n" 196 " Mark text one character leftwards.\n" 197 "Shift - Right Arrow\n" 198 " Mark text one character rightwards.\n" 200 " Select the whole text.\n" 202 " Move the cursor one character leftwards." 204 const char *editortxt5 =
206 " Copy the marked text to the clipboard.\n" 208 " Delete the character to the right of the cursor.\n" 210 " Move the cursor to the end of the line.\n" 212 " Start Search Dialog.\n" 214 " Delete the character to the left of the cursor.\n" 216 " Delete marked text if any or delete all\n" 217 " characters to the right of the cursor.\n" 219 " Start GoTo Line Dialog" 221 const char *editortxt6 =
223 " Delete all characters on the line.\n" 225 " Paste the clipboard text into line edit.\n" 227 " Cut the marked text, copy to clipboard.\n" 229 " Paste the clipboard text into line edit.\n" 232 "All other keys with valid ASCII codes insert themselves into the line.";
253 TGPopupMenu *fMenuFile, *fMenuTest, *fMenuView, *fMenuHelp;
254 TGPopupMenu *fCascadeMenu, *fCascade1Menu, *fCascade2Menu;
256 TGLayoutHints *fMenuBarLayout, *fMenuBarItemLayout, *fMenuBarHelpLayout;
265 void HandleMenu(
Int_t id);
266 void HandlePopup() { printf(
"menu popped up\n"); }
267 void HandlePopdown() { printf(
"menu popped down\n"); }
269 void Created() { Emit(
"Created()"); }
270 void Welcome() { printf(
"TestMainFrame has been created. Welcome!\n"); }
281 TGButton *fOkButton, *fCancelButton, *fStartB, *fStopB;
282 TGButton *fBtn1, *fBtn2, *fChk1, *fChk2, *fRad1, *fRad2;
310 void DoTab(
Int_t id);
311 void HandleButtons(
Int_t id = -1);
322 TGButton *fTestButton, *fCloseButton;
335 UInt_t options = kVerticalFrame);
336 virtual ~TestMsgBox();
363 virtual ~TestSliders();
367 void DoText(const
char *
text);
368 void DoSlider(
Int_t pos = 0);
390 void HandleButtons();
406 virtual ~TestDirList();
423 void DisplayFile(const
TString &fname);
424 void DisplayDirectory(const
TString &fname);
429 virtual ~TestFileList();
451 virtual ~TestProgress();
485 virtual ~EntryTestDlg();
507 void LoadFile(
const char *
file);
508 void LoadBuffer(
const char *buffer);
509 void AddBuffer(
const char *buffer);
511 TGTextEdit *GetEditor()
const {
return fEdit; }
537 TGFrame *GetFrame()
const {
return fFrame; }
539 void SetCanvas(
TGCanvas *canvas) { fCanvas = canvas; }
540 void HandleMouseWheel(
Event_t *event);
549 fFrame->Connect(
"ProcessedEvent(Event_t*)",
"TileFrame",
this,
550 "HandleMouseWheel(Event_t*)");
559 void TileFrame::HandleMouseWheel(
Event_t *event)
568 if (!fCanvas)
return;
569 if (fCanvas->GetContainer()->GetHeight())
570 page =
Int_t(
Float_t(fCanvas->GetViewPort()->GetHeight() *
571 fCanvas->GetViewPort()->GetHeight()) /
572 fCanvas->GetContainer()->GetHeight());
577 Int_t newpos = fCanvas->GetVsbPosition() - page;
578 if (newpos < 0) newpos = 0;
579 fCanvas->SetVsbPosition(newpos);
583 Int_t newpos = fCanvas->GetVsbPosition() + page;
584 fCanvas->SetVsbPosition(newpos);
598 fMain->Connect(
"CloseWindow()",
"TestMainFrame",
this,
"CloseWindow()");
604 fMenuDock->SetWindowName(
"GuiTest Menu");
614 fMenuFile->AddEntry(
"&Close", -1);
615 fMenuFile->AddSeparator();
616 fMenuFile->AddEntry(
"&Print", M_FILE_PRINT);
617 fMenuFile->AddEntry(
"P&rint setup...", M_FILE_PRINTSETUP);
618 fMenuFile->AddSeparator();
622 fMenuFile->HideEntry(M_FILE_PRINT);
630 fCascade1Menu->
AddEntry(
"ID = 4&1", 41);
631 fCascade1Menu->AddEntry(
"ID = 4&2", 42);
632 fCascade1Menu->AddEntry(
"ID = 4&3", 43);
633 fCascade1Menu->AddSeparator();
634 fCascade1Menu->AddPopup(
"Cascade&d 2", fCascade2Menu);
637 fCascadeMenu->
AddEntry(
"ID = 5&1", 51);
638 fCascadeMenu->AddEntry(
"ID = 5&2", 52);
639 fCascadeMenu->AddEntry(
"ID = 5&3", 53);
640 fCascadeMenu->AddSeparator();
641 fCascadeMenu->AddPopup(
"&Cascaded 1", fCascade1Menu);
644 fMenuTest->
AddLabel(
"Test different features...");
645 fMenuTest->AddSeparator();
646 fMenuTest->AddEntry(
"&Dialog...",
M_TEST_DLG);
650 fMenuTest->AddEntry(
"&List Directory...", M_TEST_DIRLIST);
651 fMenuTest->AddEntry(
"&File List...", M_TEST_FILELIST);
653 fMenuTest->AddEntry(
"&Number Entry...", M_TEST_NUMBERENTRY);
654 fMenuTest->AddEntry(
"F&ont Dialog...", M_TEST_FONTDIALOG);
655 fMenuTest->AddSeparator();
656 fMenuTest->AddEntry(
"Add New Menus", M_TEST_NEWMENU);
657 fMenuTest->AddSeparator();
658 fMenuTest->AddPopup(
"&Cascaded menus", fCascadeMenu);
661 fMenuView->
AddEntry(
"&Dock", M_VIEW_DOCK);
662 fMenuView->AddEntry(
"&Undock", M_VIEW_UNDOCK);
663 fMenuView->AddSeparator();
664 fMenuView->AddEntry(
"Enable U&ndock", M_VIEW_ENBL_DOCK);
665 fMenuView->AddEntry(
"Enable &Hide", M_VIEW_ENBL_HIDE);
666 fMenuView->DisableEntry(M_VIEW_DOCK);
668 fMenuDock->EnableUndock(
kTRUE);
669 fMenuDock->EnableHide(
kTRUE);
670 fMenuView->CheckEntry(M_VIEW_ENBL_DOCK);
671 fMenuView->CheckEntry(M_VIEW_ENBL_HIDE);
675 fMenuDock->Connect(
"Undocked()",
"TestMainFrame",
this,
"HandleMenu(=M_VIEW_UNDOCK)");
680 fMenuHelp->AddSeparator();
684 fMenuNew1->AddEntry(
"Remove New Menus", M_NEW_REMOVEMENU);
687 fMenuNew2->AddEntry(
"Remove New Menus", M_NEW_REMOVEMENU);
691 fMenuFile->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
692 "HandleMenu(Int_t)");
693 fMenuFile->Connect(
"PoppedUp()",
"TestMainFrame",
this,
"HandlePopup()");
694 fMenuFile->Connect(
"PoppedDown()",
"TestMainFrame",
this,
"HandlePopdown()");
695 fMenuTest->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
696 "HandleMenu(Int_t)");
697 fMenuView->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
698 "HandleMenu(Int_t)");
699 fMenuHelp->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
700 "HandleMenu(Int_t)");
701 fCascadeMenu->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
702 "HandleMenu(Int_t)");
703 fCascade1Menu->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
704 "HandleMenu(Int_t)");
705 fCascade2Menu->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
706 "HandleMenu(Int_t)");
707 fMenuNew1->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
708 "HandleMenu(Int_t)");
709 fMenuNew2->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
710 "HandleMenu(Int_t)");
713 fMenuBar->AddPopup(
"&File", fMenuFile, fMenuBarItemLayout);
714 fMenuBar->AddPopup(
"&Test", fMenuTest, fMenuBarItemLayout);
715 fMenuBar->AddPopup(
"&View", fMenuView, fMenuBarItemLayout);
716 fMenuBar->AddPopup(
"&Help", fMenuHelp, fMenuBarHelpLayout);
718 fMenuDock->AddFrame(fMenuBar, fMenuBarLayout);
721 fCanvasWindow =
new TGCanvas(fMain, 400, 240);
722 fContainer =
new TileFrame(fCanvasWindow->GetViewPort());
724 fCanvasWindow->SetContainer(fContainer->GetFrame());
730 for (
int i=0; i < 256; ++i)
731 fCanvasWindow->AddFrame(
new TGFrame(fCanvasWindow->GetContainer(),
742 fTestButton =
new TGTextButton(fStatusFrame,
"&Open editor...", 150);
743 fTestButton->
Connect(
"Clicked()",
"TestMainFrame",
this,
"DoButton()");
748 fTestText->SetToolTipText(
"This is a text entry widget");
749 fTestText->Resize(300, fTestText->GetDefaultHeight());
753 gClient->GetColorByName(
"yellow", yellow);
761 fMain->SetWindowName(
"GuiTest Signal/Slots");
763 fMain->MapSubwindows();
769 Connect(
"Created()",
"TestMainFrame",
this,
"Welcome()");
782 delete fCascade1Menu;
783 delete fCascade2Menu;
798 void TestMainFrame::DoButton()
804 ed->AddBuffer(editortxt2);
805 ed->AddBuffer(editortxt3);
806 ed->AddBuffer(editortxt4);
807 ed->AddBuffer(editortxt5);
808 ed->AddBuffer(editortxt6);
812 void TestMainFrame::HandleMenu(
Int_t id)
824 printf(
"fIniDir = %s\n", fi.
fIniDir);
832 printf(
"M_FILE_SAVE\n");
836 printf(
"M_FILE_PRINT\n");
837 printf(
"Hiding itself, select \"Print Setup...\" to enable again\n");
838 fMenuFile->HideEntry(M_FILE_PRINT);
841 case M_FILE_PRINTSETUP:
842 printf(
"M_FILE_PRINTSETUP\n");
843 printf(
"Enabling \"Print\"\n");
844 fMenuFile->EnableEntry(M_FILE_PRINT);
852 new TestDialog(
gClient->GetRoot(), fMain, 400, 200);
856 new TestMsgBox(
gClient->GetRoot(), fMain, 400, 200);
860 new TestSliders(
gClient->GetRoot(), fMain, 400, 200);
864 new TestShutter(
gClient->GetRoot(), fMain, 400, 200);
868 new TestDirList(
gClient->GetRoot(), fMain, 400, 200);
871 case M_TEST_FILELIST:
872 new TestFileList(
gClient->GetRoot(), fMain, 400, 200);
879 case M_TEST_NUMBERENTRY:
880 new EntryTestDlg(
gClient->GetRoot(), fMain);
883 case M_TEST_FONTDIALOG:
887 if (prop.
fName !=
"")
888 printf(
"Selected font: %s, size %d, italic %s, bold %s, color 0x%lx, align %u\n",
896 if (fMenuTest->IsEntryChecked(M_TEST_NEWMENU)) {
897 HandleMenu(M_NEW_REMOVEMENU);
900 fMenuTest->CheckEntry(M_TEST_NEWMENU);
902 fMenuBar->AddPopup(
"New 1", fMenuNew1, fMenuBarItemLayout, p);
903 p = fMenuBar->GetPopup(
"Help");
904 fMenuBar->
AddPopup(
"New 2", fMenuNew2, fMenuBarItemLayout, p);
905 fMenuBar->MapSubwindows();
909 fMenuTest->AddEntry(
"Remove New Menus", M_NEW_REMOVEMENU, 0, 0, e);
913 case M_NEW_REMOVEMENU:
915 fMenuBar->RemovePopup(
"New 1");
916 fMenuBar->RemovePopup(
"New 2");
918 fMenuTest->DeleteEntry(M_NEW_REMOVEMENU);
919 fMenuTest->UnCheckEntry(M_TEST_NEWMENU);
923 case M_VIEW_ENBL_DOCK:
924 fMenuDock->EnableUndock(!fMenuDock->EnableUndock());
925 if (fMenuDock->EnableUndock()) {
926 fMenuView->CheckEntry(M_VIEW_ENBL_DOCK);
927 fMenuView->EnableEntry(M_VIEW_UNDOCK);
929 fMenuView->UnCheckEntry(M_VIEW_ENBL_DOCK);
930 fMenuView->DisableEntry(M_VIEW_UNDOCK);
934 case M_VIEW_ENBL_HIDE:
935 fMenuDock->EnableHide(!fMenuDock->EnableHide());
936 if (fMenuDock->EnableHide()) {
937 fMenuView->CheckEntry(M_VIEW_ENBL_HIDE);
939 fMenuView->UnCheckEntry(M_VIEW_ENBL_HIDE);
944 fMenuDock->DockContainer();
945 fMenuView->EnableEntry(M_VIEW_UNDOCK);
946 fMenuView->DisableEntry(M_VIEW_DOCK);
950 fMenuDock->UndockContainer();
951 fMenuView->EnableEntry(M_VIEW_DOCK);
952 fMenuView->DisableEntry(M_VIEW_UNDOCK);
956 printf(
"Menu item %d selected\n",
id);
969 fMain->Connect(
"CloseWindow()",
"TestDialog",
this,
"DoClose()");
970 fMain->DontCallClose();
978 fOkButton->
Connect(
"Clicked()",
"TestDialog",
this,
"DoOK()");
979 fCancelButton =
new TGTextButton(fFrame1,
"&Cancel", 2);
980 fCancelButton->
Connect(
"Clicked()",
"TestDialog",
this,
"DoCancel()");
987 fFrame1->
AddFrame(fCancelButton, fL1);
990 fMain->AddFrame(fFrame1, fL2);
994 fTab =
new TGTab(fMain, 300, 300);
995 fTab->
Connect(
"Selected(Int_t)",
"TestDialog",
this,
"DoTab(Int_t)");
1008 tf = fTab->
AddTab(
"Tab 2");
1025 for (i = 0; i < 20; i++) {
1027 sprintf(tmp,
"Entry %i", i+1);
1033 fBtn1->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1034 fBtn2->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1035 fChk1->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1036 fChk2->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1037 fRad1->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1038 fRad2->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1045 tf = fTab->
AddTab(
"Tab 3");
1047 fStartB =
new TGTextButton(fF3,
"Start &Filling Hists", 40);
1048 fStopB =
new TGTextButton(fF3,
"&Stop Filling Hists", 41);
1049 fStartB->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1050 fStopB->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1071 "HandleEmbeddedCanvas(Int_t,Int_t,Int_t,TObject*)");
1075 gClient->GetColorByName(
"yellow", yellow);
1082 tf = fTab->
AddTab(
"Tab 4");
1085 bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1088 bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1092 fCheckMulti->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1095 for (i = 0; i < 20; ++i) {
1096 sprintf(tmp,
"Entry %i", i);
1102 fListBox->
Resize(150, 80);
1105 tf = fTab->
AddTab(
"Tab 5");
1116 for (j = 0; j < 4; j++) {
1117 sprintf(buff,
"Module %i", j+1);
1125 tent->
SetFont(
"-adobe-courier-bold-r-*-*-14-*-*-*-*-*-iso8859-1");
1131 fF7 =
new TGGroupFrame(tf,
"Tab Handling", kVerticalFrame);
1137 bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1141 bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1145 bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1154 fMain->AddFrame(fTab, fL5);
1156 fMain->MapSubwindows();
1160 fMain->CenterOnParent();
1162 fMain->SetWindowName(
"Dialog");
1172 fMain->DeleteWindow();
1182 fHpx =
new TH1F(
"hpx",
"This is the px distribution",100,-4,4);
1183 fHpxpy =
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
1193 while (fFillHistos) {
1196 fHpxpy->
Fill(px,py);
1198 if (!(cnt % kUPDATE)) {
1199 if (cnt == kUPDATE) {
1203 fHpxpy->
Draw(
"cont");
1214 void TestDialog::DoClose()
1216 printf(
"\nTerminating dialog: via window manager\n");
1235 void TestDialog::DoOK()
1238 printf(
"\nTerminating dialog: OK pressed\n");
1260 void TestDialog::DoCancel()
1263 printf(
"\nTerminating dialog: Cancel pressed\n");
1273 void TestDialog::HandleButtons(
Int_t id)
1282 printf(
"DoButton: id = %d\n",
id);
1285 static int newtab = 0;
1289 fFillHistos =
kTRUE;
1303 sprintf(tmp,
"Entry %i", fLastEntry);
1304 fListBox->
AddEntry(tmp, fLastEntry);
1309 if (fFirstEntry <= fLastEntry) {
1318 if ((s ==
"Tab 3") && (fMain->MustCleanup() !=
kDeepCleanup)) {
1323 delete fEc1; fEc1 = 0;
1324 delete fEc2; fEc2 = 0;
1333 for (
int i = 0 ; i < nt; i++) {
1344 sprintf(tmp,
"New Tab %d", ++newtab);
1363 void TestDialog::DoTab(
Int_t id)
1365 printf(
"Tab item %d activated\n",
id);
1374 printf(
"event = %d, x = %d, y = %d, obj = %s::%s\n", event, x, y,
1380 fRedTextGC(
TGButton::GetDefaultGC())
1387 fMain->Connect(
"CloseWindow()",
"TestMsgBox",
this,
"CloseWindow()");
1388 fMain->DontCallClose();
1398 gClient->GetColorByName(
"red", red);
1404 fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) |
kHorizontalFrame);
1412 fTestButton =
new TGTextButton(f1,
"&Test", 1, fRedTextGC());
1413 fTestButton->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoTest()");
1417 gClient->GetColorByName(
"green", green);
1421 fCloseButton->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoClose()");
1437 fMain->AddFrame(f1, fL21);
1464 for (i=0; i<13; ++i) fG1->
AddFrame(fC[i], fL4);
1471 for (i = 0; i < 4; ++i) {
1473 fR[i]->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoRadio()");
1488 fTbtitle->
AddText(0,
"MsgBox");
1489 fTbmsg->
AddText(0,
"This is a test message box.");
1508 fMain->AddFrame(f2, fL2);
1510 fMain->MapSubwindows();
1514 fMain->CenterOnParent();
1516 fMain->SetWindowName(
"Message Box Test");
1529 fMain->DeleteWindow();
1539 void TestMsgBox::DoClose()
1546 void TestMsgBox::DoTest()
1550 int i, buttons, retval;
1554 for (i = 0; i < 13; i++)
1556 buttons |= mb_button_id[i];
1558 for (i = 0; i < 4; i++)
1560 icontype = mb_icon[i];
1567 fMain->Disconnect(
"CloseWindow()");
1568 fMain->Connect(
"CloseWindow()",
"TestMsgBox",
this,
"TryToClose()");
1571 icontype, buttons, &retval);
1573 fMain->Connect(
"CloseWindow()",
"TestMsgBox",
this,
"CloseWindow()");
1577 void TestMsgBox::TryToClose()
1581 printf(
"Can't close the window '%s' : a message box is still open\n", fMain->GetWindowName());
1584 void TestMsgBox::DoRadio()
1591 if (
id >= 21 &&
id <= 24) {
1592 for (
int i = 0; i < 4; i++)
1593 if (fR[i]->WidgetId() !=
id)
1605 fMain->Connect(
"CloseWindow()",
"TestSliders",
this,
"CloseWindow()");
1606 fMain->DontCallClose();
1611 fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) |
kHorizontalFrame);
1620 fTeh1->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
1621 fTev1->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
1624 fHslider1->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
1628 fVslider1->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
1631 fVframe1->
Resize(100, 100);
1639 fTeh2->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
1640 fTev2->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
1643 fHslider2->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
1649 fVslider2->
Connect(
"PositionChanged()",
"TestSliders",
this,
"DoSlider()");
1650 fVframe2->
Resize(100, 100);
1658 fVframe1->
AddFrame(fHslider1, fBly);
1659 fVframe1->
AddFrame(fVslider1, fBly);
1663 fVframe2->
AddFrame(fHslider2, fBly);
1664 fVframe2->
AddFrame(fVslider2, fBly);
1668 fMain->AddFrame(fVframe2, fBfly1);
1669 fMain->AddFrame(fVframe1, fBfly1);
1671 fMain->SetWindowName(
"Slider Test");
1673 fMain->Resize(size);
1684 fMain->CenterOnParent();
1686 fMain->MapSubwindows();
1696 fMain->DeleteWindow();
1706 void TestSliders::DoText(
const char * )
1732 void TestSliders::DoSlider(
Int_t pos)
1747 sprintf(buf,
"%d", pos);
1766 else if (
id ==
VSId1) {
1778 else if (
id ==
HSId2) {
1790 else if (
id ==
VSId2) {
1813 fMain->Connect(
"CloseWindow()",
"TestShutter",
this,
"CloseWindow()");
1814 fMain->DontCallClose();
1819 fDefaultPic =
gClient->GetPicture(
"folder_s.xpm");
1822 AddShutterItem(
"Histograms", histo_data);
1823 AddShutterItem(
"Functions", function_data);
1824 AddShutterItem(
"Trees", tree_data);
1827 fMain->AddFrame(fShutter, fLayout);
1829 fMain->MapSubwindows();
1830 fMain->Resize(80, 300);
1833 fMain->CenterOnParent();
1835 fMain->SetWindowName(
"Shutter Test");
1847 static int id = 5001;
1856 buttonpic =
gClient->GetPicture(data[i].pixmap_name);
1858 printf(
"<TestShutter::AddShutterItem>: missing pixmap \"%s\", using default",
1859 data[i].pixmap_name);
1860 buttonpic = fDefaultPic;
1866 button->
Connect(
"Clicked()",
"TestShutter",
this,
"HandleButtons()");
1878 gClient->FreePicture(fDefaultPic);
1879 fMain->DeleteWindow();
1887 void TestShutter::HandleButtons()
1890 printf(
"Shutter button %d\n", btn->
WidgetId());
1900 fMain->Connect(
"CloseWindow()",
"TestDirList",
this,
"CloseWindow()");
1901 fMain->DontCallClose();
1903 fIcon =
gClient->GetPicture(
"rootdb_t.xpm");
1912 fMain->AddFrame(canvas,lo);
1913 fContents->
Connect(
"DoubleClicked(TGListTreeItem*,Int_t)",
"TestDirList",
this,
1914 "OnDoubleClick(TGListTreeItem*,Int_t)");
1915 fContents->
Connect(
"Clicked(TGListTreeItem*,Int_t)",
"TestDirList",
this,
1916 "OnDoubleClick(TGListTreeItem*,Int_t)");
1924 fMain->CenterOnParent();
1926 fMain->SetWindowName(
"List Dir Test");
1928 fMain->MapSubwindows();
1933 TestDirList::~TestDirList()
1942 void TestDirList::CloseWindow()
1973 TList *files = dir.GetListOfFiles();
1983 if ((fname!=
"..") && (fname!=
".")) {
1984 fContents->
AddItem(item,fname);
1986 }
else if (fname.
EndsWith(
".root")) {
1987 fContents->
AddItem(item,fname,fIcon,fIcon);
2002 fMain->Connect(
"CloseWindow()",
"TestDirList",
this,
"CloseWindow()");
2003 fMain->DontCallClose();
2010 fMain->AddFrame(mb, lo);
2015 fMenu->AddEntry(
"&List",
kLVList);
2017 fMenu->AddSeparator();
2018 fMenu->AddEntry(
"&Close", 10);
2019 fMenu->Connect(
"Activated(Int_t)",
"TestFileList",
this,
"DoMenu(Int_t)");
2023 fMain->AddFrame(lv,lo);
2026 gClient->GetColorByName(
"white", white);
2028 fContents->
Connect(
"DoubleClicked(TGFrame*,Int_t)",
"TestFileList",
this,
2029 "OnDoubleClick(TGLVEntry*,Int_t)");
2032 fMain->CenterOnParent();
2034 fMain->SetWindowName(
"File List Test");
2035 fMain->MapSubwindows();
2037 fContents->SetDefaultHeaders();
2038 fContents->DisplayDirectory();
2039 fContents->AddFile(
"..");
2041 fContents->StopRefreshTimer();
2045 TestFileList::~TestFileList()
2053 void TestFileList::DoMenu(
Int_t mode)
2064 void TestFileList::DisplayFile(
const TString &fname)
2072 fContents->SetColHeaders(
"Name",
"Title");
2074 TIter next(file.GetListOfKeys());
2077 while ((key=(
TKey*)next())) {
2078 TString cname = key->GetClassName();
2079 TString name = key->GetName();
2090 void TestFileList::DisplayDirectory(
const TString &fname)
2094 fContents->SetDefaultHeaders();
2096 fContents->ChangeDirectory(fname);
2097 fContents->DisplayDirectory();
2098 fContents->AddFile(
"..");
2102 void TestFileList::DisplayObject(
const TString& fname,
const TString& name)
2108 static TFile *file = 0;
2109 if (file)
delete file;
2110 file =
new TFile(fname);
2116 }
else obj->
Print();
2132 const char* fname = (
const char*)f->
GetUserData();
2135 DisplayObject(fname, name);
2136 }
else if (name.
EndsWith(
".root")) {
2139 DisplayDirectory(name);
2146 void TestFileList::CloseWindow()
2159 fMain->Connect(
"CloseWindow()",
"TestProgress",
this,
"DoClose()");
2160 fMain->DontCallClose();
2165 fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) |
kHorizontalFrame);
2170 fVProg1->SetBarColor(
"purple");
2173 fVProg2->SetBarColor(
"green");
2175 fHframe1->Resize(300, 300);
2180 fHProg1->ShowPosition();
2182 fHProg2->SetBarColor(
"lightblue");
2183 fHProg2->ShowPosition(
kTRUE,
kFALSE,
"%.0f events");
2188 fGO->Connect(
"Clicked()",
"TestProgress",
this,
"DoGo()");
2190 fVframe1->
Resize(300, 300);
2198 fHframe1->AddFrame(fVProg1, fHint1);
2199 fHframe1->AddFrame(fVProg2, fHint1);
2201 fVframe1->
AddFrame(fHProg1, fHint2);
2202 fVframe1->
AddFrame(fHProg2, fHint2);
2203 fVframe1->
AddFrame(fHProg3, fHint2);
2206 fMain->AddFrame(fHframe1, fHint4);
2207 fMain->AddFrame(fVframe1, fHint5);
2209 fMain->SetWindowName(
"Progress Test");
2211 fMain->Resize(size);
2214 fMain->CenterOnParent();
2216 fMain->MapSubwindows();
2226 fMain->DeleteWindow();
2236 void TestProgress::DoClose()
2255 void TestProgress::DoGo()
2260 fVProg1->Reset(); fVProg2->Reset();
2261 fHProg1->Reset(); fHProg2->Reset(); fHProg3->Reset();
2262 fVProg2->SetBarColor(
"green");
2263 int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
2264 int inc1 = 4, inc2 = 3, inc3 = 2, inc4 = 1;
2265 while (cnt1 < 100 || cnt2 < 100 || cnt3 < 100 || cnt4 <100) {
2268 fVProg1->Increment(inc1);
2272 fVProg2->Increment(inc2);
2274 fVProg2->SetBarColor(
"red");
2278 fHProg1->Increment(inc3);
2282 fHProg2->Increment(inc4);
2283 fHProg3->Increment(inc4);
2296 const char *numlabel[] = {
2314 12345, 1.0, 1.00, 1.000, 1.0000, 1.2E-12,
2315 90 * 3600, 120 * 60, 12 * 60, 12 * 3600 + 15 * 60,
2316 19991121, 19991121, (
Double_t) 0xDEADFACEU
2323 fMain->Connect(
"CloseWindow()",
"EntryTestDlg",
this,
"CloseWindow()");
2324 fMain->DontCallClose();
2329 TGGC myGC = *
gClient->GetResourcePool()->GetFrameGC();
2330 TGFont *myfont =
gClient->GetFont(
"-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
2335 fMain->AddFrame(fF1, fL1);
2337 for (
int i = 0; i < 13; i++) {
2340 fNumericEntries[i] =
new TGNumberEntry(fF[i], numinit[i], 12, i + 20,
2342 fF[i]->AddFrame(fNumericEntries[i], fL2);
2344 fF[i]->AddFrame(fLabel[i], fL2);
2348 fMain->AddFrame(fF2, fL3);
2352 fLimits[0]->SetLogStep(
kFALSE);
2357 fLimits[1]->SetLogStep(
kFALSE);
2364 fSetButton->Connect(
"Clicked()",
"EntryTestDlg",
this,
"SetLimits()");
2367 fExitButton->Connect(
"Clicked()",
"EntryTestDlg",
this,
"DoOK()");
2371 fMain->SetWindowName(
"Number Entry Test");
2372 fMain->SetIconName(
"Number Entry Test");
2373 fMain->SetClassHints(
"NumberEntryDlg",
"NumberEntryDlg");
2375 fMain->MapSubwindows();
2376 UInt_t width = fMain->GetDefaultWidth();
2377 UInt_t height = fMain->GetDefaultHeight();
2378 fMain->Resize(width, height);
2379 fMain->CenterOnParent();
2381 fMain->SetWMSize(width, height);
2382 fMain->SetWMSizeHints(width, height, width, height, 0, 0);
2392 EntryTestDlg::~EntryTestDlg()
2396 fMain->DeleteWindow();
2399 void EntryTestDlg::CloseWindow()
2404 void EntryTestDlg::DoOK()
2408 fMain->SendCloseMessage();
2411 void EntryTestDlg::SetLimits()
2413 Double_t min = fLimits[0]->GetNumber();
2415 Double_t max = fLimits[1]->GetNumber();
2437 for (
int i = 0; i < 13; i++) {
2438 fNumericEntries[i]->SetFormat(fNumericEntries[i]->GetNumStyle(), attr);
2439 fNumericEntries[i]->SetLimits(lim, min, max);
2449 fMain->
Connect(
"CloseWindow()",
"Editor",
this,
"CloseWindow()");
2450 fMain->DontCallClose();
2457 fMain->AddFrame(fEdit, fL1);
2458 fEdit->Connect(
"Opened()",
"Editor",
this,
"DoOpen()");
2459 fEdit->Connect(
"Saved()",
"Editor",
this,
"DoSave()");
2460 fEdit->Connect(
"Closed()",
"Editor",
this,
"DoClose()");
2464 gClient->GetColorByName(
"#3399ff", pxl);
2465 fEdit->SetSelectBack(pxl);
2469 fOK->Connect(
"Clicked()",
"Editor",
this,
"DoOK()");
2471 fMain->AddFrame(fOK, fL2);
2475 fMain->MapSubwindows();
2487 fMain->DeleteWindow();
2494 TGText *txt = GetEditor()->GetText();
2499 sprintf(title,
"ROOT Editor - Untitled");
2501 sprintf(title,
"ROOT Editor - %s", txt->
GetFileName());
2503 fMain->SetWindowName(title);
2504 fMain->SetIconName(title);
2518 fEdit->LoadBuffer(buffer);
2525 fEdit->LoadFile(file);
2528 void Editor::AddBuffer(
const char *buffer)
2534 fEdit->AddText(&txt);
2551 void Editor::DoOpen()
2556 void Editor::DoSave()
2561 void Editor::DoClose()
2576 int main(
int argc,
char **argv)
2580 if (
gROOT->IsBatch()) {
2581 fprintf(stderr,
"%s: cannot run in batch mode\n", argv[0]);
virtual Float_t GetMinPosition() const
virtual const char * GetName() const
Returns name of object.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Int_t GetCursorPosition() const
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
TestMsgBox(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t options=kVerticalFrame)
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
virtual void * GetUserData() const =0
TestProgress(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h)
virtual void RemoveAll()
Remove all items from the container.
virtual const char * WorkingDirectory()
Return working directory.
void LoadFile(const char *file)
virtual void SetRange(Int_t min, Int_t max)
virtual void CloseWindow()
Close and delete main frame.
R__EXTERN void * gTQSender
void SetForeground(Pixel_t v)
Set foreground color.
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
static Pixel_t GetWhitePixel()
Get white pixel value.
virtual void CloseWindow()
Close and delete main frame.
virtual void SetBorderMode(Short_t bordermode)
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual TGDimension GetDefaultSize() const
Returns default size.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
tomato 1-D histogram with a float per channel (see TH1 documentation)}
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
virtual void SetMultipleSelections(Bool_t multi=kTRUE)
virtual void SetSubnames(const char *n1="", const char *n2="", const char *n3="", const char *n4="", const char *n5="", const char *n6="", const char *n7="", const char *n8="", const char *n9="", const char *n10="", const char *n11="", const char *n12="")
Sets new subnames.
TileFrame(const TGWindow *p)
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
virtual void SetRange(Float_t min, Float_t max)
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
R__EXTERN TApplication * gApplication
virtual Bool_t IsDirectory(const char *dir=0) const
Check if object is a directory.
virtual void Layout()
Layout the elements of the composite frame.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Bool_t LoadBuffer(const char *txtbuf)
Load a 0 terminated buffer. Lines will be split at ' '.
const Mask_t kPointerMotionMask
virtual void ChangeBackground(Pixel_t back)
Change frame background color.
virtual void AddItem(TGShutterItem *item)
Add shutter item to shutter frame.
virtual void SetTitlePos(ETitlePos pos=kLeft)
void Deselect()
Deselects all text (i.e.
TGFrame * GetContainer() const
virtual void CloseWindow()
Close and delete main frame.
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual void CloseWindow()
Close and delete main frame.
virtual void SetUserData(void *, Bool_t=kFALSE)
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
const char * GetString() const
void AddText(Int_t pos, const char *text)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
Editor(const TGWindow *main, UInt_t w, UInt_t h)
const char * GetFileName() const
virtual void CloseWindow()
Close and delete main frame.
Describes an Operating System directory for the browser.
TestDialog(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t options=kVerticalFrame)
const Mask_t kButtonPressMask
void SetFont(FontH_t v)
Set font.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
void SetUserData(void *userData)
void SetCanvas(TGCanvas *canvas)
R__EXTERN TSystem * gSystem
virtual void Draw(Option_t *option="")
Draw this histogram with options.
void * GetUserData() const
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
TestSliders(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h)
tomato 2-D histogram with a float per channel (see TH1 documentation)}
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual const char * GetText() const =0
virtual void SetPosition(Int_t pos)
virtual UInt_t GetDefaultWidth() const
virtual void RemoveTab(Int_t tabIndex=-1, Bool_t storeRemoved=kTRUE)
Remove container and tab of tab with index tabIndex.
virtual const char * GetTitle() const
Returns title of object.
R__EXTERN TRandom * gRandom
#define RQ_OBJECT(sender_class)
char * StrDup(const char *str)
Duplicate the string str.
void AddShutterItem(const char *name, shutterData_t data[])
virtual UInt_t GetDefaultHeight() const
TGListTreeItem * GetParent() const
void LoadBuffer(const char *buffer)
virtual void SetPagePosition(const TGPosition &pos)
Set page position.
virtual void SetCursorPosition(Int_t pos)
Set the cursor position to newPos.
virtual void AddEntry(TGString *s, Int_t id)
const Mask_t kButtonReleaseMask
TCanvas * GetCanvas() const
Describe directory structure in memory.
FontStruct_t GetFontStruct() const
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
void CloseWindow()
Close and delete main frame.
Mother of all ROOT objects.
virtual void Layout()
Layout the listbox components.
A TSystemFile describes an operating system file.
virtual void SetFont(TGFont *font, Bool_t local=kTRUE)
Changes text font specified by pointer to TGFont object.
double f2(const double *x)
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
virtual void SetPosition(Float_t min, Float_t max)
const char * GetString() const
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
static void Terminate()
Close the global pad editor. Static method.
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
TestShutter(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h)
virtual void Update()
Update canvas pad buffers.
virtual void CloseWindow()
Close and delete main frame.
virtual const char * GetName() const
Returns name of object.
virtual void DeleteWindow()
Delete window.
Int_t Fill(Double_t)
Invalid Fill method.
Int_t GetNumberOfTabs() const
Return number of tabs.
const Mask_t kAnyModifier
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
void Modified(Bool_t flag=1)
int main(int argc, char **argv)
TestMainFrame(const TGWindow *p, UInt_t w, UInt_t h)
virtual void RemoveEntry(Int_t id=-1)
remove entry with id.
const char * Data() const
FontH_t GetFontHandle() const